norman / friendly_id

FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
http://norman.github.io/friendly_id/
MIT License
6.15k stars 590 forks source link

Rails 7.1 composite key support #1018

Open freibuis opened 1 year ago

freibuis commented 1 year ago

using rails 7.1 with composite + freindly_id will give the following error

extend FriendlyId
friendly_id :name, use: :slugged
`scope_for_slug_generator': ["column_one", "column_two"] is not a symbol nor a string (TypeError)
scope.where(self.class.base_class.arel_table[primary_key_name].not_eq(send(primary_key_name)))

normally the

primary_key_name = self.class.primary_key

would return a string but with composite keys it will return an array.

so above example is

self.class.primary_key  
 ["column_one", "column_two"]
Mechetel commented 1 day ago

same