Module: ArsPermalink::ClassMethods

Defined in:
lib/ars-permalink.rb

Instance Method Summary collapse

Instance Method Details



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ars-permalink.rb', line 29

def permalink(method, options = {})
  use = options[:history] ? :history : :slugged
  
  field :slug, :index => { :unique => true }
  validates :slug, :presence => true, :uniqueness => true
  
  if ActiveRecord::Base.connection.table_exists?(self.table_name)
    self.send :extend, FriendlyId
    friendly_id method, :use => use        
  end
end