lib/friendly_id.rb
# Set up an ActiveRecord model to use a friendly_id.
# 
# The method argument can be one of your model's columns, or a method
# you use to generate the slug.
#
# Options:
# * <tt>:use_slug</tt> - Defaults to false. Use slugs when you want to use a non-unique text field for friendly ids.
# * <tt>:max_length</tt> - Defaults to 255. The maximum allowed length for a slug.
# * <tt>:strip_diacritics</tt> - Defaults to false. If true, it will remove accents, umlauts, etc. from western characters. You must have the unicode gem installed for this to work.
Set up an ActiveRecord model to use a friendly_id.
The method argument can be one of your model's columns, or a method
you use to generate the slug.

:use_slug - Defaults to false. Use slugs when you want to use a non-unique text field for friendly ids.
:max_length - Defaults to 255. The maximum allowed length for a slug.
:strip_diacritics - Defaults to false. If true, it will remove accents, umlauts, etc. from western characters. You must have the unicode gem installed for this to work.
Set up an ActiveRecord model to use a friendly_id . The method argument can be one of your model ' s columns or a method you use to generate the slug . : use_slug - Defaults to false . Use slugs when you want to use a non - unique text field for friendly ids . : max_length - Defaults to 255 . The maximum allowed length for a slug . : strip_diacritics - Defaults to false . If true it will remove accents umlauts etc . from western characters . You must have the unicode gem installed for this to work .
def has_friendly_id(method, options = {})
        options.assert_valid_keys(:use_slug, :max_length, :strip_diacritics)
        options = default_friendly_id_options.merge(options).merge(:method => method)
        write_inheritable_attribute(:friendly_id_options, options)
        class_inheritable_reader :friendly_id_options
        if options[:use_slug]
          has_many :slugs, :order => "id DESC", :as => :sluggable,
            :dependent => :destroy
          before_save :set_slug
          include SluggableInstanceMethods
          extend SluggableClassMethods  
        else
          include NonSluggableInstanceMethods
          extend NonSluggableClassMethods  
        end
      end
def has_friendly_id ( method , options = { } ) options . assert_valid_keys ( :use_slug , :max_length , :strip_diacritics ) options = default_friendly_id_options . merge ( options ) . merge ( :method => method ) write_inheritable_attribute ( :friendly_id_options , options ) class_inheritable_reader :friendly_id_options if options [ :use_slug ] has_many :slugs , :order => "id DESC" , :as => :sluggable , :dependent => :destroy before_save :set_slug include SluggableInstanceMethods extend SluggableClassMethods else include NonSluggableInstanceMethods extend NonSluggableClassMethods end end
Set up an ActiveRecord model to use a friendly_id.
Set up an ActiveRecord model to use a friendly_id .
method
options