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



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

def body=(value)
  write_attribute(:body, value)

  normalise_text_fields
end

#slug_matches?(other_slug) ⇒ Boolean

Returns:

  • (Boolean)


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

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



16
17
18
# File 'pages/app/models/refinery/page_part.rb', line 16

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