Module: HasSlug::NotSluggableInstanceMethods
- Defined in:
- lib/has_slug/not_sluggable_instance_methods.rb
Instance Attribute Summary collapse
-
#found_by_slug ⇒ Object
readonly
Returns the value of attribute found_by_slug.
Instance Method Summary collapse
- #found_by_slug! ⇒ Object
- #found_by_slug? ⇒ Boolean
- #slug ⇒ Object
- #sluggable ⇒ Object
- #to_param ⇒ Object
Instance Attribute Details
#found_by_slug ⇒ Object (readonly)
Returns the value of attribute found_by_slug.
2 3 4 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 2 def found_by_slug @found_by_slug end |
Instance Method Details
#found_by_slug! ⇒ Object
4 5 6 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 4 def found_by_slug! @found_by_slug = true end |
#found_by_slug? ⇒ Boolean
8 9 10 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 8 def found_by_slug? @found_by_slug end |
#slug ⇒ Object
16 17 18 19 20 21 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 16 def slug id = self.send(self.class.primary_key) slug = self.sluggable.to_slug(:preserve => [:preserve]) "#{id}-#{slug}" end |
#sluggable ⇒ Object
12 13 14 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 12 def sluggable read_attribute(self.class.[:attribute]) end |
#to_param ⇒ Object
23 24 25 |
# File 'lib/has_slug/not_sluggable_instance_methods.rb', line 23 def to_param self.slug end |