diff options
| author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-09 01:55:26 +0900 | 
|---|---|---|
| committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-09 01:55:26 +0900 | 
| commit | fc173b0a2452dcaa527fd21d264ba2296d4fa72a (patch) | |
| tree | 31689f8ee4cc070e6acee89481313e7fc4812c09 /activerecord/lib | |
| parent | b691c2147565cd3e7c4574e01a00ded55317df8d (diff) | |
| download | rails-fc173b0a2452dcaa527fd21d264ba2296d4fa72a.tar.gz rails-fc173b0a2452dcaa527fd21d264ba2296d4fa72a.tar.bz2 rails-fc173b0a2452dcaa527fd21d264ba2296d4fa72a.zip  | |
Consistently use `visitor.compile`
Diffstat (limited to 'activerecord/lib')
| -rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 6 | ||||
| -rw-r--r-- | activerecord/lib/arel/visitors/to_sql.rb | 4 | 
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 1d36c3c8b1..fdc9ffa688 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -20,7 +20,7 @@ module ActiveRecord              raise "Passing bind parameters with an arel AST is forbidden. " \                "The values must be stored on the AST directly"            end -          sql, binds = visitor.accept(arel_or_sql_string.ast, collector).value +          sql, binds = visitor.compile(arel_or_sql_string.ast, collector)            [sql.freeze, binds || []]          else            [arel_or_sql_string.dup.freeze, binds] @@ -32,11 +32,11 @@ module ActiveRecord        # can be used to query the database repeatedly.        def cacheable_query(klass, arel) # :nodoc:          if prepared_statements -          sql, binds = visitor.accept(arel.ast, collector).value +          sql, binds = visitor.compile(arel.ast, collector)            query = klass.query(sql)          else            collector = PartialQueryCollector.new -          parts, binds = visitor.accept(arel.ast, collector).value +          parts, binds = visitor.compile(arel.ast, collector)            query = klass.partial_query(parts)          end          [query, binds] diff --git a/activerecord/lib/arel/visitors/to_sql.rb b/activerecord/lib/arel/visitors/to_sql.rb index 5986fd5576..0682c066fb 100644 --- a/activerecord/lib/arel/visitors/to_sql.rb +++ b/activerecord/lib/arel/visitors/to_sql.rb @@ -67,8 +67,8 @@ module Arel # :nodoc: all          @connection = connection        end -      def compile(node, &block) -        accept(node, Arel::Collectors::SQLString.new, &block).value +      def compile(node, collector = Arel::Collectors::SQLString.new, &block) +        accept(node, collector, &block).value        end        private  | 
