diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/media_attachment.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index af1a4b9af..3beb96e3a 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -10,4 +10,12 @@ class MediaAttachment < ApplicationRecord def local? self.remote_url.blank? end + + def file_remote_url=(url) + unless self[:file_remote_url] == url + self.file = URI.parse(url) + end + + self[:file_remote_url] = url + end end |