Module: Sluggy::ClassMethods
- Defined in:
- lib/sluggy.rb
Instance Method Summary collapse
Instance Method Details
#slug_for(base, options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/sluggy.rb', line 9 def slug_for(base, ={}) .reverse_merge!(:column => :permalink, :base => base, :scope => nil) validates [:column], :presence => true, :format => { :with => Sluggy::SLUG_REGEX }, :length => { :within => 1..100 }, :uniqueness => ([:scope] ? {:scope => [:scope]} : true) before_validation :generate_slug class_eval %{ def self.sluggy_options; #{}; end } include Sluggy::InstanceMethods end |