Class: Refinery::PagePart

Inherits:
Core::BaseModel show all
Defined in:
pages/app/models/refinery/page_part.rb

Instance Method Summary collapse

Methods inherited from Core::BaseModel

#users_manager

Instance Method Details

#body=(value) ⇒ Object



18
19
20
21
22
# File 'pages/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 'pages/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 'pages/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_paramObject



14
15
16
# File 'pages/app/models/refinery/page_part.rb', line 14

def to_param
  "page_part_#{slug.downcase.gsub(/\W/, '_')}"
end