diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..0aec50e6 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1.4 diff --git a/lib/ransack/search.rb b/lib/ransack/search.rb index a8bf95f8..3d7b8a51 100644 --- a/lib/ransack/search.rb +++ b/lib/ransack/search.rb @@ -102,14 +102,14 @@ def new_sort(opts = {}) def method_missing(method_id, *args) method_name = method_id.to_s getter_name = method_name.sub(/=$/, ''.freeze) - if base.attribute_method?(getter_name) - base.send(method_id, *args) - elsif @context.ransackable_scope?(getter_name, @context.object) + if @context.ransackable_scope?(getter_name, @context.object) if method_name =~ /=$/ add_scope getter_name, args else @scope_args[method_name] end + elsif base.attribute_method?(getter_name) + base.send(method_id, *args) else super end