Class: Refinery::PagePart
- Inherits:
-
Core::BaseModel
- Object
- Core::BaseModel
- Refinery::PagePart
- Defined in:
- app/models/refinery/page_part.rb
Instance Method Summary collapse
- #body=(value) ⇒ Object
- #slug_matches?(other_slug) ⇒ Boolean
- #title_matches?(other_title) ⇒ Boolean
- #to_param ⇒ Object
Instance Method Details
#body=(value) ⇒ Object
18 19 20 21 22 |
# File 'app/models/refinery/page_part.rb', line 18 def body=(value) super normalise_text_fields end |
#slug_matches?(other_slug) ⇒ Boolean
24 25 26 27 28 29 |
# File 'app/models/refinery/page_part.rb', line 24 def slug_matches?(other_slug) slug.present? && (# protecting against the problem that occurs when have two nil slugs slug == other_slug.to_s || parameterized_slug == parameterize(other_slug.to_s) ) end |
#title_matches?(other_title) ⇒ Boolean
31 32 33 34 |
# File 'app/models/refinery/page_part.rb', line 31 def title_matches?(other_title) Refinery.deprecate("Refinery::PagePart#title_matches?", when: "3.1", replacement: "slug_matches?") slug_matches?(other_title.to_s.parameterize.underscore) end |
#to_param ⇒ Object
14 15 16 |
# File 'app/models/refinery/page_part.rb', line 14 def to_param "page_part_#{slug.downcase.gsub(/\W/, '_')}" end |