ruling_template/app/models/r_template.rb

27 lines
844 B
Ruby
Raw Normal View History

2017-08-02 09:07:55 +00:00
class RTemplate
include Mongoid::Document
include Mongoid::Timestamps
include OrbitModel::Status
include OrbitTag::Taggable
include OrbitCategory::Categorizable
include Slug
field :title, as: :slug_title, :localize => true
field :description, :localize => true
field :price, :type => Integer
field :allowed, :type => Boolean, :default => true
field :user_id
field :colors, :type => Array, :default => []
field :sold, :type => Boolean, :default => false
mount_uploader :template_zip, AssetUploader
has_many :template_image_files, :autosave => true, :dependent => :destroy
has_one :template_psd_file, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :template_image_files, :allow_destroy => true
accepts_nested_attributes_for :template_psd_file, :allow_destroy => true
end