diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-27 09:52:54 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-27 09:52:54 -0700 |
commit | aac9da257f291ad8d2d4f914528881c240848bb2 (patch) | |
tree | 4ba06fbdc5f8f2d2a533abc7e7b3c0f14ad5d1aa /lib/arel/visitors/to_sql.rb | |
parent | d36a769234911c8374e09069eb054d4c60eb1b99 (diff) | |
download | rails-aac9da257f291ad8d2d4f914528881c240848bb2.tar.gz rails-aac9da257f291ad8d2d4f914528881c240848bb2.tar.bz2 rails-aac9da257f291ad8d2d4f914528881c240848bb2.zip |
Change the interface of `having` to match that of `where`
These two clauses have nearly identical semantics with regards to how
they would be constructed as an AST. It doesn't make sense for their
interfaces to be separate.
Diffstat (limited to 'lib/arel/visitors/to_sql.rb')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index acf0a74d37..7dfa86a575 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -265,7 +265,10 @@ module Arel end end - collector = maybe_visit o.having, collector + unless o.havings.empty? + collector << " HAVING " + inject_join o.havings, collector, AND + end unless o.windows.empty? collector << WINDOW @@ -404,11 +407,6 @@ module Arel end end - def visit_Arel_Nodes_Having o, collector - collector << "HAVING " - visit o.expr, collector - end - def visit_Arel_Nodes_Offset o, collector collector << "OFFSET " visit o.expr, collector |