2012-10-24 10:40:38 +00:00
|
|
|
class Image
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
2011-10-18 03:21:24 +00:00
|
|
|
|
|
|
|
field :html_id
|
|
|
|
field :html_class
|
2012-10-24 10:40:38 +00:00
|
|
|
field :in_css, :type => Boolean, :default => false
|
|
|
|
field :in_html, :type => Boolean, :default => false
|
|
|
|
field :name
|
2011-09-14 07:11:50 +00:00
|
|
|
|
|
|
|
mount_uploader :file, ImageUploader
|
2012-10-24 10:40:38 +00:00
|
|
|
|
|
|
|
belongs_to :design
|
|
|
|
|
|
|
|
before_save :set_name
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def set_name
|
|
|
|
self.name = self.file_identifier
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|