Fix named functions within subqueries

Arel is currently casting values compared against NamedFunctions improperly. 

Using tables from the test suite, the statement

    products.project(products[:id]).where(products[:id].in(users.project(users[:id]).where(users[:name].lower.eq('foo')))) 

currently generates

    (SELECT \"products\".\"id\" FROM \"products\"  WHERE \"products\".\"id\" IN (SELECT \"users\".\"id\" FROM \"users\"  WHERE LOWER(\"users\".\"name\") = 0))

With these changes, it properly generates

    (SELECT \"products\".\"id\" FROM \"products\"  WHERE \"products\".\"id\" IN (SELECT \"users\".\"id\" FROM \"users\"  WHERE LOWER(\"users\".\"name\") = 'foo'))
would be more readable if on separate line.