Class: C::Page

Inherits:
ApplicationRecord show all
Includes:
Authorable, Documentable, Imageable, Orderable, Previewable, SitePage
Defined in:
app/models/c/page.rb

Constant Summary collapse

INDEX_TABLE =
{
  "Name": { link: { name: { call: 'name' }, options: '[:edit, object]' }, sort: 'name' },
  "Author": { call: 'author', sort: 'author' },
  "Published": { call: 'published', sort: 'published' },
  "Created": { call: 'created_at', sort: 'published' },
  "Edit": { link: { name: { text: 'edit' }, options: '[:edit, object]' } }
}.freeze

Instance Method Summary collapse

Instance Method Details

#build_product_pointsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/models/c/page.rb', line 25

def build_product_points
  case product_points.count
  when 3
    return
  when 2
    1.times { product_points.build }
  when 1
    2.times { product_points.build }
  when 0
    3.times { product_points.build }
  else
    return
  end
end