Sha256: 90666e0a24226b9304d68345edd56d957bc0a3ac52c3d5b3194866c1bdc063ee
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
module RademadeAdmin module Search class Mongoid < Abstract protected def where(where_conditions) # todo if defined?(::Mongoid::Paranoia) and @model.ancestors.include? ::Mongoid::Paranoia where_conditions[:and][:deleted_at] = nil end method_map = { :or => :or, :and => :where } where_conditions.each do |type, conditions| conditions.each do |field, value| if value.is_a? Array field = field.in end @result = @result.send(method_map[type], field => value) end end @result end def order(order_conditions) order_conditions.each do |order_condition| @result = @result.order_by(order_condition) end @result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.0.1 | app/services/search/query_adapter/mongoid.rb |