Class: Skyline::Sections::ContentItemSection
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Skyline::Sections::ContentItemSection
- Includes:
- Skyline::SectionItem
- Defined in:
- app/models/skyline/sections/content_item_section.rb
Class Method Summary collapse
Methods included from Skyline::SectionItem
Class Method Details
.register_selectable_model(klass) ⇒ Object
20 21 22 23 24 |
# File 'app/models/skyline/sections/content_item_section.rb', line 20 def register_selectable_model(klass) self.selectable_models ||= [] self.selectable_models.delete_if{|c| c.to_s == klass.to_s } # Hack to remove stale object self.selectable_models << klass end |
.selectable_content_models ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/skyline/sections/content_item_section.rb', line 11 def selectable_content_models # lazy load all models in /app/models (not recursive) to find all Content models Dir.chdir(File.join(Rails.root, "app", "models")) do Dir.glob("*.rb").map{|f| f.sub(".rb","").camelcase.constantize} end Rails.logger.info "Selectable models for ContentItemSections: " + Skyline::Sections::ContentItemSection.selectable_models.inspect selectable_models || [] end |