Module: FriendlyId::ActiveRecordAdapter

Includes:
Base
Included in:
ActiveRecord::Base
Defined in:
lib/friendly_id/active_record.rb,
lib/friendly_id/active_record_adapter/finders.rb,
lib/friendly_id/active_record_adapter/relation.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

Defined Under Namespace

Modules: Finders, Relation, SimpleModel, SluggedModel Classes: Configuration

Instance Method Summary collapse

Methods included from Base

#uses_friendly_id?

Instance Method Details

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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/friendly_id/active_record.rb', line 12

def has_friendly_id(method, options = {})
  if FriendlyId.on_ar3?
    class_attribute :friendly_id_config
    self.friendly_id_config = Configuration.new(self, method, options)
  else
    class_inheritable_accessor :friendly_id_config
    write_inheritable_attribute :friendly_id_config, Configuration.new(self, method, options)
  end

  if friendly_id_config.use_slug?
    include SluggedModel
  else
    include SimpleModel
  end
end