module ActiverecordExtensions::QueryBuilder

Public Instance Methods

where_gt(attribute, value) click to toggle source
# File lib/activerecord-extensions/query_builder.rb, line 4
def where_gt(attribute, value)
  where_with_bind(arel_table[attribute].gt(Arel::Nodes::BindParam.new), {attribute => value})
end
where_in(attribute, values) click to toggle source
# File lib/activerecord-extensions/query_builder.rb, line 12
def where_in(attribute, values)
  bind_params = values.map{ Arel::Nodes::BindParam.new }
  column_values = values.each_with_object([]) { |value, column_values| column_values.push [attribute, value] }
  where_with_bind(arel_table[attribute].in(bind_params), column_values)
end
where_lt(attribute, value) click to toggle source
# File lib/activerecord-extensions/query_builder.rb, line 8
def where_lt(attribute, value)
  where_with_bind(arel_table[attribute].lt(Arel::Nodes::BindParam.new), {attribute => value})
end
where_with_bind(clause, opt) click to toggle source
# File lib/activerecord-extensions/query_builder.rb, line 18
def where_with_bind(clause, opt)
  where(clause).bind_parameters(opt)
end