Class: ElasticsearchRecord::StatementCache::PartialQuery
- Inherits:
-
ActiveRecord::StatementCache::PartialQuery
- Object
- ActiveRecord::StatementCache::PartialQuery
- ElasticsearchRecord::StatementCache::PartialQuery
- Defined in:
- lib/elasticsearch_record/statement_cache.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(values) ⇒ PartialQuery
constructor
A new instance of PartialQuery.
- #sql_for(binds, connection) ⇒ Object
Constructor Details
#initialize(values) ⇒ PartialQuery
Returns a new instance of PartialQuery.
7 8 9 10 |
# File 'lib/elasticsearch_record/statement_cache.rb', line 7 def initialize(values) @values = values # no need to create indexes end |
Instance Method Details
#sql_for(binds, connection) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/elasticsearch_record/statement_cache.rb', line 12 def sql_for(binds, connection) # dup original array claims = @values.deep_dup # substitute binds claims.each do |claim| # action, args = claim claim[1] = deep_substitute_binds(claim[1], binds, connection) end # build a new query collector collector = ::Arel::Collectors::ElasticsearchQuery.new claims.each do |claim| collector << claim end collector end |