Change assets
This commit is contained in:
1 parent
80e84c10ba
commit
0b0916179f
24 files changed
+346
-71
No files matched your search
@@ -9,5 +9,8 @@ class Asset
|
||||
field :description
|
||||
|
||||
validates_presence_of :filename, :data
|
||||
|
||||
belongs_to :asset_category
|
||||
belongs_to :assetable, polymorphic: true
|
||||
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
class AssetCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :key
|
||||
field :display
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
has_many :assets
|
||||
|
||||
def self.from_id(id)
|
||||
AssetCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user