Question

i'm trying to use (Friendly_Id 5.0.0.Beta4) in (Rails 4) with 2 models but just work with one.

I have this models:

class Author < ActiveRecord::Base
has_many :articles
extend FriendlyId
friendly_id :name, use: :slugged
end

class Category < ActiveRecord::Base
has_many :articles
extend FriendlyId
friendly_id :title, use: :slugged
end

But friendly_id just work with Author model. Can anyone helpme?

Was it helpful?

Solution

Can you be more specific about the error you are facing. In rails 4, friendly_id will not automatically overwrite the active record finders. and you should do that manually.

Check here for friendly_id implementation of rails 4 .

http://kapilrajnakhwa.com/blogs/user-friendly-urls-with-friendly_id-gem-in-rails-4

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top