Sha256: 03705bbdc871964a20aab7fc9e529312902ead904bf3f8a9edf74b0c39846548
Contents?: true
Size: 991 Bytes
Versions: 5
Compression:
Stored size: 991 Bytes
Contents
# Use this Module in all classes you want to be found in the ContentItemSection # # # Usage: # class Model < ActiveRecord::Base # include Skyline::ContentItemSectionSelectable # end # # # 1) Registers your model in the Skyline::Sections::ContentItemSection.selectable_models list # # 2) Gives your Model the following interface: # # class Model < ActiveRecord::Base # -- If the model has a 'published' column: # named_scope :for_content_item_section, :conditions => {:published => true} # -- else # named_scope :for_content_item_section, {} # end module Skyline::ContentItemSectionSelectable def self.included(base) Skyline::Sections::ContentItemSection.register_selectable_model(base) if base.column_names.include?("published") base.send :named_scope, :for_content_item_section, :conditions => {:published => true} else base.send :named_scope, :for_content_item_section, {} end end end
Version data entries
5 entries across 5 versions & 2 rubygems