Module: HasPermalink

Defined in:
lib/railtie.rb,
lib/utilities.rb,
lib/has_permalink.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: Railtie, Utilities

Instance Method Summary collapse

Instance Method Details



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/has_permalink.rb', line 6

def has_permalink(generate_from = :title, auto_fix_duplication = false)
  unless included_modules.include? InstanceMethods
    class_attribute :generate_from
    class_attribute :auto_fix_duplication
    extend ClassMethods
    include InstanceMethods
  end

  self.generate_from        = generate_from
  self.auto_fix_duplication = auto_fix_duplication
  before_validation :generate_permalink
end