diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-16 20:55:29 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-16 20:55:29 -0800 |
commit | 7354602f6f11db09f7e58a833dcf9cb141abf50a (patch) | |
tree | 460f08b06d53560c024072119511cc5992206bd3 /lib | |
parent | 99b2188f9495068399000b891c2c9b66331c4b02 (diff) | |
download | rails-7354602f6f11db09f7e58a833dcf9cb141abf50a.tar.gz rails-7354602f6f11db09f7e58a833dcf9cb141abf50a.tar.bz2 rails-7354602f6f11db09f7e58a833dcf9cb141abf50a.zip |
adding support for scalar selects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/sql.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/active_relation/sql.rb b/lib/active_relation/sql.rb index bc658271c3..0384de44ef 100644 --- a/lib/active_relation/sql.rb +++ b/lib/active_relation/sql.rb @@ -18,7 +18,7 @@ module ActiveRelation end def select(select_sql, aliaz) - "(#{select_sql}) AS #{quote_column_name(aliaz)}" + "(#{select_sql})" + (aliaz ? " AS #{quote_column_name(aliaz)}" : "") end end @@ -44,7 +44,7 @@ module ActiveRelation class Aggregation < Strategy def select(select_sql, aliaz) - "(#{select_sql}) AS #{quote_table_name(aliaz)}" + "(#{select_sql}) AS #{quote_table_name(aliaz)}" end end |