Module: Knitkit::Extensions::ActiveRecord::ThemeSupport::HasManyThemes::ActMacro

Defined in:
lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb

Instance Method Summary collapse

Instance Method Details

#has_many_themes(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb', line 11

def has_many_themes(options = {})
  return if has_many_themes?

  has_many :themes, :dependent => :delete_all do
    def active
      find(:all, :conditions => 'active = 1')
    end
  end
      
  include InstanceMethods # FIXME instead, check for the association being present
end

#has_many_themes?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb', line 23

def has_many_themes?
  included_modules.include?(Knitkit::Extensions::ActiveRecord::ThemeSupport::HasManyThemes::InstanceMethods)
end