Class: Refinery::PagePart

Inherits:
Core::BaseModel show all
Extended by:
Mobility
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


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

def body=(value)
  super

  normalise_text_fields
end

#slug_matches?(other_slug) ⇒ Boolean

Returns:

  • (Boolean)

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

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


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

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