app/concerns/controller/query_conditions.rb in rails-add_ons-1.4.0 vs app/concerns/controller/query_conditions.rb in rails-add_ons-1.4.1
- old
+ new
@@ -1,12 +1,11 @@
module Controller::QueryConditions
private
def add_conditions_from_query(scope)
- request.query_parameters.each do |field, condition|
+ query_params.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'
@@ -17,7 +16,19 @@
condition_statement = ::Api::ResourcesController::ConditionParser.new(scope, field, condition).condition_statement
scope = scope.where(condition_statement)
end
end
scope
+ end
+
+ def query_params
+ default_query_params
+ end
+
+ def default_query_params
+ request.query_parameters.except(*default_query_params_exceptions)
+ end
+
+ def default_query_params_exceptions
+ %w(sort_by sort_direction utf8 commit page)
end
end