Sha256: 8d34913dae583d5d31681eee185a025abb4fc51c695b8ea124f53daa87971f9c
Contents?: true
Size: 708 Bytes
Versions: 1
Compression:
Stored size: 708 Bytes
Contents
module Controller::QueryConditions private def add_conditions_from_query(scope) request.query_parameters.each do |field, condition| case field when 'sort_by', 'sort_direction', 'utf8', 'commit', 'page' when 'limit' scope = scope.limit(condition.to_i) when 'offset' scope = scope.offset(condition.to_i) when 'order' scope = scope.order(condition) when 'includes' scope = scope.includes(condition.map(&:to_sym)) else condition_statement = ::Api::ResourcesController::ConditionParser.new(scope, field, condition).condition_statement scope = scope.where(condition_statement) end end scope end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-add_ons-1.4.0 | app/concerns/controller/query_conditions.rb |