Module: FriendlyId::ActiveRecordAdapter

Includes:
Base
Included in:
ActiveRecord::Base
Defined in:
lib/friendly_id/active_record_adapter/finders.rb,
lib/friendly_id/active_record.rb,
lib/friendly_id/active_record_adapter/simple_model.rb,
lib/friendly_id/active_record_adapter/configuration.rb,
lib/friendly_id/active_record_adapter/slugged_model.rb

Overview

The adapter for Ruby on Rails’s ActiveRecord. Compatible with AR 2.2.x - 2.3.x.

Defined Under Namespace

Modules: Compat, FinderMethods, Finders, SimpleModel, SluggedModel Classes: Configuration

Instance Method Summary collapse

Methods included from Base

#uses_friendly_id?

Instance Method Details

#has_friendly_id(method, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/friendly_id/active_record.rb', line 13

def has_friendly_id(method, options = {})
  class_inheritable_accessor :friendly_id_config
  write_inheritable_attribute :friendly_id_config, Configuration.new(self, method, options)
  if friendly_id_config.use_slug?
    include SluggedModel
  else
    include SimpleModel
  end
end