| Module | FleskPlugins::ActsAsSluggable::ClassMethods |
| In: |
lib/acts_as_sluggable.rb
|
Create a "sluggable_attribute" accessor on the model class.
# File lib/acts_as_sluggable.rb, line 15
15: def self.extended(base)
16: class << base
17: self.instance_eval do
18: attr_accessor :sluggable_attribute
19: end
20: end
21: end
Make this class behave sluggish. Takes an options hash. options[:with] is the name of the attribute you want to create the slug from. E.g. acts_as_sluggable :with => ‘title’
# File lib/acts_as_sluggable.rb, line 26
26: def acts_as_sluggable(options = {})
27: self.sluggable_attribute = options[:with] if options[:with]
28: self.send(:include, InstanceMethods)
29: end