Module: SpeakingId::ClassMethods
- Defined in:
- lib/speaking_id/speaking_id.rb
Instance Method Summary collapse
- #has_random_slug(options = {}) ⇒ Object
- #has_slug(source, options = {}) ⇒ Object
- #speaking_id(options = {}) ⇒ Object
Instance Method Details
#has_random_slug(options = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/speaking_id/speaking_id.rb', line 17 def has_random_slug( = {}) speaking_id() before_create :create_random_slug end |
#has_slug(source, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/speaking_id/speaking_id.rb', line 7 def has_slug(source, = {}) speaking_id() class_inheritable_accessor :slug_source self.slug_source = source before_save :create_slug end |
#speaking_id(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/speaking_id/speaking_id.rb', line 23 def speaking_id( = {}) send :include, InstanceMethods class_inheritable_accessor :slug_column self.slug_column = ([:column] || :slug).to_s validates_uniqueness_of self.slug_column end |