Skip to content

Commit

Permalink
Issue activerecord-hackery#1472 suggested fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abMatGit committed Jan 9, 2024
1 parent cc624b9 commit 92e330a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.4
6 changes: 3 additions & 3 deletions lib/ransack/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92e330a

Please sign in to comment.