Module: ZenSlug::ClassMethods

Defined in:
lib/zen_slug.rb

Instance Method Summary collapse

Instance Method Details

#has_a_slug_from(attribute_name) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/zen_slug.rb', line 18

def has_a_slug_from(attribute_name)
  include FriendlyId
  friendly_id attribute_name.to_sym, :use=>:slugged
  validates :slug, :presence => true, :uniqueness => true
  #, :format => {:with => /\A[^0-9].*/}
  class_eval <<-EOV
    include SlugableMixin::Overrides
  EOV
end