RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: pablosalgadom
I would recommend to override the should_generate_new_friendly_id? method, because it will only change the slug when ONLY needs to do it.
class Post < ActiveRecord::Base extend FriendlyId friendly_id :title, :use => :slugged def should_generate_new_friendly_id? title_changed? end end
I would recommend to override the should_generate_new_friendly_id? method, because it will only change the slug when ONLY needs to do it.