Skip to content

Commit

Permalink
Evaluate ransackable_scopes before attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
faragorn committed Feb 3, 2017
1 parent 4adfd10 commit d71e6da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ransack/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def build(params)
collapse_multiparameter_attributes!(params).each do |key, value|
if ['s'.freeze, 'sorts'.freeze].freeze.include?(key)
send("#{key}=", value)
elsif base.attribute_method?(key)
base.send("#{key}=", value)
elsif @context.ransackable_scope?(key, @context.object)
add_scope(key, value)
elsif base.attribute_method?(key)
base.send("#{key}=", value)
elsif !Ransack.options[:ignore_unknown_conditions]
raise ArgumentError, "Invalid search term #{key}"
end
Expand Down

0 comments on commit d71e6da

Please sign in to comment.