Module: CustomQueryMethods::ActiveRecord

Defined in:
lib/custom_query_methods/active_record.rb

Instance Method Summary collapse

Instance Method Details

#where_bind(opts = :chain, *rest) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/custom_query_methods/active_record.rb', line 3

def where_bind(opts = :chain, *rest)
  if :chain == opts
    ::ActiveRecord::QueryMethods::WhereChain.new(spawn)
  elsif opts.blank?
    self
  else
    spawn.where_bind!(opts, *rest)
  end
end

#where_bind!(opts, *rest) ⇒ Object

:nodoc:



13
14
15
16
17
18
# File 'lib/custom_query_methods/active_record.rb', line 13

def where_bind!(opts, *rest) # :nodoc:
  opts = sanitize_forbidden_attributes(opts)
  references!(::ActiveRecord::PredicateBuilder.references(opts)) if Hash === opts
  self.where_clause += where_clause_factory.build(opts, rest)
  self
end