Orbit/app/models/ad_banner.rb

31 lines
774 B
Ruby
Raw Permalink Normal View History

2012-01-31 10:31:31 +00:00
class AdBanner
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitTag::Taggable
include OrbitModel::Authorizable
2012-05-15 01:57:05 +00:00
2012-02-02 01:55:09 +00:00
field :ad_fx #TODO Design should explain
2013-10-18 07:25:19 +00:00
field :height, type: Integer
field :speed, type: Integer
field :title
field :timeout, type: Integer
field :width, type: Integer
2012-04-01 15:39:49 +00:00
has_many :ad_images , dependent: :delete
2013-10-18 07:25:19 +00:00
validates_uniqueness_of :title
validates :title, :length => { :minimum => 2 }
validates :height, :speed, :timeout, :width, :presence => true
FX_TYPES = %w(fade fadeout flipHorz flipVert scrollHorz scrollVert tileSlide tileBlind)
2013-10-18 07:25:19 +00:00
def size
"#{self.width} x #{self.height}"
end
def timeout_millisecond
2013-10-18 07:25:19 +00:00
self.timeout*1000 rescue 0
2012-04-23 09:03:55 +00:00
end
2012-02-02 01:55:09 +00:00
2012-01-31 10:31:31 +00:00
end