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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top