lib/video.rb in ish_models-0.0.33.182 vs lib/video.rb in ish_models-0.0.33.183
- old
+ new
@@ -27,31 +27,26 @@
end
field :is_public, :type => Boolean, :default => false
field :is_feature, :type => Boolean, :default => false
- field :x, :type => Float
- field :y, :type => Float
+ field :x, type: Float
+ field :y, type: Float
+ field :z, type: Float
field :lang, :type => String, :default => 'en'
- field :youtube_id, :type => String
- validates :youtube_id, :uniqueness => true, allow_nil: true
+ field :youtube_id
+ validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
+ before_save { youtube_id.present? || youtube_id = nil }
-
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
def self.list
[['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
end
- set_callback( :create, :before ) do |doc|
- if doc.is_public
- doc.city.add_newsitem( doc ) unless doc.city.blank?
- doc.site.add_newsitem( doc ) unless doc.site.blank?
- end
- end
field :issue
field :subhead
has_mongoid_attached_file :video,
@@ -81,13 +76,9 @@
:path => "videos/:style/:id/thumb_:filename",
:s3_protocol => 'https',
:validate_media_type => false,
s3_region: ::S3_CREDENTIALS[:region]
validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
-
- set_callback :update, :after do |doc|
- Site.update_all updated_at: Time.now
- end
## copy-paste
field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
def is_premium
premium_tier > 0