Class: Section
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Section
- Extended by:
- ActiveSupport::Memoizable
- Defined in:
- app/models/section.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inherited(child) ⇒ Object
16 17 18 19 |
# File 'app/models/section.rb', line 16 def inherited(child) types << child.name super end |
.type_names ⇒ Object
21 22 23 |
# File 'app/models/section.rb', line 21 def type_names @type_names ||= types.map(&:underscore) end |
Instance Method Details
#attributes_protected_by_default ⇒ Object
38 39 40 41 42 |
# File 'app/models/section.rb', line 38 def attributes_protected_by_default default = [self.class.primary_key] default << 'id' unless self.class.primary_key.eql? 'id' default end |
#home? ⇒ Boolean
34 35 36 |
# File 'app/models/section.rb', line 34 def home? root? && previous_sibling.nil? end |
#path ⇒ Object
30 31 32 |
# File 'app/models/section.rb', line 30 def path home? ? '' : super end |
#type ⇒ Object
26 27 28 |
# File 'app/models/section.rb', line 26 def type read_attribute(:type) || 'Page' end |