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
26 27 28 29 |
# File 'app/models/section.rb', line 26 def inherited(child) types << child.name super end |
.type_names ⇒ Object
31 32 33 |
# File 'app/models/section.rb', line 31 def type_names @type_names ||= types.map(&:underscore) end |
Instance Method Details
#attributes_protected_by_default ⇒ Object
48 49 50 51 52 |
# File 'app/models/section.rb', line 48 def attributes_protected_by_default default = [self.class.primary_key] default << 'id' unless self.class.primary_key.eql? 'id' default end |
#home? ⇒ Boolean
44 45 46 |
# File 'app/models/section.rb', line 44 def home? root? && previous_sibling.nil? end |
#path ⇒ Object
40 41 42 |
# File 'app/models/section.rb', line 40 def path _path == site.home_section.send(:_path) ? '' : _path end |
#type ⇒ Object
36 37 38 |
# File 'app/models/section.rb', line 36 def type read_attribute(:type) || 'Section' end |