Class: ConstructorPages::Template
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ConstructorPages::Template
- Includes:
- CodeNameUniq
- Defined in:
- app/models/constructor_pages/template.rb
Overview
Template model. Template allows assing different design for pages.
Templates has many fields. For example:
template "Product" should has fields like "price", "description", "size" etc.
Instance Method Summary collapse
-
#child ⇒ Object
Return child corresponding child_id or children first.
-
#to_accusative ⇒ Object
Convert name to accusative.
Methods included from CodeNameUniq
Instance Method Details
#child ⇒ Object
Return child corresponding child_id or children first
25 26 27 28 29 30 31 |
# File 'app/models/constructor_pages/template.rb', line 25 def child if child_id self.class.find(child_id) else children.first if !leaf? end end |
#to_accusative ⇒ Object
Convert name to accusative
34 35 36 |
# File 'app/models/constructor_pages/template.rb', line 34 def to_accusative self.name.mb_chars.downcase.to_s.accusative end |