replace CarrierWave 3.x removed _changed? methods with changed_attributes
This commit is contained in:
parent
63d9214082
commit
800d4f5ec2
|
|
@ -37,19 +37,19 @@ class AdImage
|
|||
scope :not_expired, ->{self.and(AdImage.unscoped.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)}
|
||||
before_save do
|
||||
unless @skip_callback
|
||||
if self.video_snapshot_changed?
|
||||
if self.video_snapshot.file.present? && self.changed_attributes.key?("video_snapshot")
|
||||
self.default_video_snapshot = false
|
||||
end
|
||||
end
|
||||
end
|
||||
after_save do
|
||||
unless @skip_callback
|
||||
if (self.video_file_changed? || self.auto_convert_video_changed?) && self.auto_convert_video
|
||||
if (self.changed_attributes.key?("video_file") || self.changed_attributes.key?("auto_convert_video")) && self.auto_convert_video
|
||||
Thread.new do
|
||||
self.generate_webm
|
||||
end
|
||||
end
|
||||
if self.video_file? && self.video_file_changed? && (!(self.video_snapshot?) || self.default_video_snapshot)
|
||||
if self.video_file? && self.changed_attributes.key?("video_file") && (!(self.video_snapshot?) || self.default_video_snapshot)
|
||||
Thread.new do
|
||||
self.generate_video_snapshot
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue