Module: ActiveRecordQuery::RelationExtension

Included in:
ActiveRecord::Relation
Defined in:
lib/active_record_query/relation_extension.rb

Instance Method Summary collapse

Instance Method Details

#any {|query| ... } ⇒ Object

Yields:

  • (query)


15
16
17
18
19
# File 'lib/active_record_query/relation_extension.rb', line 15

def any
  query = ActiveRecord::Query.new(table, :or)
  yield query
  where(query.arel)
end

#where(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/active_record_query/relation_extension.rb', line 5

def where(*args)
  if args.empty? && block_given?
    query = ActiveRecord::Query.new(table, :and)
    yield query
    super query.arel
  else
    super
  end
end