about summary refs log tree commit diff
path: root/app/models/media_attachment.rb
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-05-18 22:43:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-18 15:43:10 +0200
commit79ef8b3653a6ff7edbc1af0741dff36522262c07 (patch)
tree161a1bec18bed8475ae780dd8e28344d0dcfbb1d /app/models/media_attachment.rb
parentb11c4326d289d8b0307f5d1466171ac147a07767 (diff)
Fetch remote image using http.rb (#3114)
Diffstat (limited to 'app/models/media_attachment.rb')
-rw-r--r--app/models/media_attachment.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index 3277eb227..c29a66eb2 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -46,6 +46,9 @@ class MediaAttachment < ApplicationRecord
                     styles: ->(f) { file_styles f },
                     processors: ->(f) { file_processors f },
                     convert_options: { all: '-quality 90 -strip' }
+
+  include Remotable
+
   validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES
   validates_attachment_size :file, less_than: 8.megabytes
 
@@ -59,10 +62,6 @@ class MediaAttachment < ApplicationRecord
     remote_url.blank?
   end
 
-  def file_remote_url=(url)
-    self.file = URI.parse(Addressable::URI.parse(url).normalize.to_s)
-  end
-
   def to_param
     shortcode
   end