Sha256: a4c627ab0cf7cc82227bb1baea4a969d1f70a59843c54c4c5d4d43103e1149d6
Contents?: true
Size: 759 Bytes
Versions: 28
Compression:
Stored size: 759 Bytes
Contents
module Cms module Behaviors module Categorizing def self.included(model_class) model_class.extend(MacroMethods) end module MacroMethods def belongs_to_category? !!@belongs_to_category end def belongs_to_category @belongs_to_category = true extend ClassMethods include InstanceMethods belongs_to :category, :class_name => 'Cms::Category' scope :in_category, lambda{|cat| {:conditions => ["category_id = ?", cat.id]}} end end module ClassMethods end module InstanceMethods def category_name category && category.name end end end end end
Version data entries
28 entries across 28 versions & 2 rubygems