module FriendlyId::Base
Public Instance Methods
has_friendly_id(method, options = {}, &block)
click to toggle source
Set up a model to use a friendly_id. This method accepts a hash with {FriendlyId::Configuration several possible options}.
@param [#to_sym] method The column or method that should be used as the
basis of the friendly_id string.
@param [Hash] options For valid configuration options, see
{FriendlyId::Configuration}.
@param [block] block An optional block through which to filter the
friendly_id text; see {FriendlyId::Configuration#normalizer}. Note that passing a block parameter is now deprecated and will be removed from FriendlyId 3.0.
@example
class User < ActiveRecord::Base has_friendly_id :user_name end class Post < ActiveRecord::Base has_friendly_id :title, :use_slug => true, :approximate_ascii => true end
@see FriendlyId::Configuration
# File lib/friendly_id.rb, line 49 def has_friendly_id(method, options = {}, &block) raise NotImplementedError end
uses_friendly_id?()
click to toggle source
Does the model class use the FriendlyId plugin?
# File lib/friendly_id.rb, line 54 def uses_friendly_id? respond_to? :friendly_id_config end