30 lines
529 B
Ruby
30 lines
529 B
Ruby
class AdImage
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
mount_uploader :file, ImageUploader
|
|
|
|
field :time_to_next #Weight
|
|
field :picture_intro
|
|
field :out_link
|
|
field :link_open
|
|
|
|
field :to_save, :type => Boolean
|
|
field :to_destroy, :type => Boolean
|
|
|
|
LINK_OPEN_TYPES = ["new_window","local"]
|
|
|
|
|
|
embedded_in :ad_banner
|
|
|
|
def get_delay_time
|
|
time = ''
|
|
if self.time_to_next.nil?
|
|
time = '1000'
|
|
else
|
|
time = (self.time_to_next.to_i * 1000).to_s
|
|
end
|
|
time
|
|
end
|
|
end
|