Skip to content

Commit

Permalink
Ensure Sluggable deals properly with multiple arguments
Browse files Browse the repository at this point in the history
Recent ActiveAdmin versions pass an array of ids when filtering by a
single value.
  • Loading branch information
mitio committed Nov 27, 2022
1 parent 2c27682 commit 3d10b9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/sluggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def to_param
module ClassMethods
def find(*args)
id = args.first
return super if args.count != 1 || id.to_s =~ /\A\d+\z/
return super if args.count != 1 || Array(id).all? { |single_id| single_id.to_s =~ /\A\d+\z/ }

find_by_slug(id) or raise ActiveRecord::RecordNotFound
end
Expand Down

0 comments on commit 3d10b9e

Please sign in to comment.