Module: Adva::Categorizable
- Extended by:
- Categorizable
- Included in:
- Categorizable
- Defined in:
- lib/adva/active_record/categorizable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#categorizable ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/adva/active_record/categorizable.rb', line 3 def categorizable unless categorizable? Category.categorizable(name.underscore.pluralize.to_sym) has_many :categories, :through => :categorizations, :as => :categorizable accepts_nested_attributes_for :categorizations, :allow_destroy => true extend ClassMethods end end |
#categorizable? ⇒ Boolean
12 13 14 |
# File 'lib/adva/active_record/categorizable.rb', line 12 def categorizable? singleton_class.included_modules.include?(ClassMethods) end |