Skip to content

Commit

Permalink
Backport to 3-0 stable branch ransack error with filters when ActiveS…
Browse files Browse the repository at this point in the history
…torage is used (#8137) (#8164)

feat: check ransackable_associations when checking searchable_has_many_through

Co-authored-by: Edmund Tay <edmundtay96@gmail.com>
  • Loading branch information
mgrunberg and Eddayy committed Dec 11, 2023
1 parent 345e02e commit f77c3c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_admin/filters/formtastic_addons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def polymorphic_foreign_type?(method)
#

def searchable_has_many_through?
if reflection && reflection.options[:through]
if klass.ransackable_associations.include?(method.to_s) && reflection && reflection.options[:through]
reflection.through_reflection.klass.ransackable_attributes.include? reflection.foreign_key
else
false
Expand Down

0 comments on commit f77c3c3

Please sign in to comment.