Module: Rtt::QueryBuilder

Included in:
Rtt
Defined in:
lib/rtt/query_builder.rb

Instance Method Summary collapse

Instance Method Details

#query(options = {}) ⇒ Object

Query among all tasks filtering based on parameters.



7
8
9
10
11
12
# File 'lib/rtt/query_builder.rb', line 7

def query options = {}
  relation = Task.where(rtt_build_conditions(options))
  relation = relation.where(table[:date].gt(options.delete(:from))) if options[:from]
  relation = relation.where(table[:date].lt(options.delete(:to))) if options[:to]
  relation
end