Module: Cms::Behaviors::Categorizing::MacroMethods

Defined in:
lib/cms/behaviors/categorizing.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to_categoryObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/cms/behaviors/categorizing.rb', line 11

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

#belongs_to_category?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/cms/behaviors/categorizing.rb', line 8

def belongs_to_category?
  !!@belongs_to_category
end