Class: Gluttonberg::AssetCategory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gluttonberg::AssetCategory
- Defined in:
- app/models/gluttonberg/asset_category.rb
Class Method Summary collapse
Class Method Details
.build_defaults ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/models/gluttonberg/asset_category.rb', line 23 def self.build_defaults # Ensure the default categories exist in the database. ensure_exists('audio', false) ensure_exists('image', false) ensure_exists('video', false) ensure_exists('document', false) ensure_exists(Library::UNCATEGORISED_CATEGORY, true) end |
.method_missing(methId, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/gluttonberg/asset_category.rb', line 11 def self.method_missing(methId, *args) method_info = methId.id2name.split('_') if method_info.length == 2 then if method_info[1] == 'category' then cat_name = method_info[0] if cat_name then return find(:first , :conditions => "name = '#{cat_name}'") end end end end |