Class: Refinery::PagePart

Inherits:
Core::BaseModel
  • Object
show all
Extended by:
Mobility
Defined in:
app/models/refinery/page_part.rb

Instance Method Summary collapse

Instance Method Details

#body=(value) ⇒ Object



26
27
28
29
30
# File 'app/models/refinery/page_part.rb', line 26

def body=(value)
  super

  normalise_text_fields
end

#contentObject



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

def content
  body
end

#content=(value) ⇒ Object



18
19
20
# File 'app/models/refinery/page_part.rb', line 18

def content=(value)
  self.body = value
end

#slug_matches?(other_slug) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
# File 'app/models/refinery/page_part.rb', line 32

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

#to_paramObject



22
23
24
# File 'app/models/refinery/page_part.rb', line 22

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