super_p && web

my little piece of "work memory"

Notes &

Friendly_id. Don’t change slug on update

If you don’t want to regenerate you slug when model change friendly_id field, use this hook:

# config/initializers/add_static_to_friendly_id.rb
module FriendlyId
  module Static
    def should_generate_new_friendly_id?
      new_record?
    end
  end
end

# your model
class MyModel < ActiveRecord::Base
  extend FriendlyId
  friendly_id :something, :use => [:slugged, :static]
end