Sha256: 817ebacbd70cbe3b1459f4b579b136746f00f41fcf6fa86de3997bbe1b53a620
Contents?: true
Size: 853 Bytes
Versions: 2
Compression:
Stored size: 853 Bytes
Contents
# -*- encoding : utf-8 -*- require 'search/conditions/abstract' module RademadeAdmin module Search module Conditions class List < Abstract protected def where where_conditions = Where.new(:and) @params.slice(*@origin_fields).each do |field, value| where_conditions.add(field, value) end where_conditions end def order field = @params[:sort] || default_order_field direction = @params[:direction] || :asc [{field => direction}] end def page @params[:page] || 1 end def per_page @params[:paginate] || 20 end private def default_order_field @origin_fields.include?('position') ? :position : :id end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.0.3 | app/services/search/conditions/list.rb |
rademade_admin-0.0.2 | app/services/search/conditions/list.rb |