From 2045aacac35acb557e33e276b18bc2380aec5d1b Mon Sep 17 00:00:00 2001 From: abMatGit Date: Mon, 8 Jan 2024 17:11:18 -0800 Subject: [PATCH] Issue #1472 suggested fix --- lib/ransack/search.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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