Skip to content

Commit

Permalink
Update context to support both %i and %w for ransachable_* methods (#…
Browse files Browse the repository at this point in the history
…1459)

Currently `ransackable_scopes` allows both, and for some reason the rest expects %w only.
  • Loading branch information
vimutter authored Nov 21, 2023
1 parent 14495bb commit cc624b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ransack/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ def unpolymorphize_association(str)
end

def ransackable_alias(str)
klass._ransack_aliases.fetch(str, str)
klass._ransack_aliases.fetch(str, klass._ransack_aliases.fetch(str.to_sym, str))
end

def ransackable_attribute?(str, klass)
klass.ransackable_attributes(auth_object).include?(str) ||
klass.ransortable_attributes(auth_object).include?(str)
klass.ransackable_attributes(auth_object).any? { |s| s.to_sym == str.to_sym } ||
klass.ransortable_attributes(auth_object).any? { |s| s.to_sym == str.to_sym }
end

def ransackable_association?(str, klass)
klass.ransackable_associations(auth_object).include? str
klass.ransackable_associations(auth_object).any? { |s| s.to_sym == str.to_sym }
end

def ransackable_scope?(str, klass)
Expand Down

0 comments on commit cc624b9

Please sign in to comment.