module Shrine::Plugins::RemoteUrl::AttacherMethods
Public Instance Methods
# File lib/shrine/plugins/remote_url.rb 87 def assign_remote_url(url, downloader: {}, **) 88 return if url == "" || url.nil? 89 90 downloaded_file = shrine_class.remote_url(url, **downloader) 91 attach_cached(downloaded_file, **) 92 rescue DownloadError => error 93 errors.clear << remote_url_error_message(url, error) 94 false 95 end
Downloads the remote file and assigns it. If download failed, sets the error message and assigns the url to an instance variable so that it shows up in the form.
Source
# File lib/shrine/plugins/remote_url.rb 104 def remote_url 105 @remote_url 106 end
Used by <name>_data_uri attachment method.
Source
# File lib/shrine/plugins/remote_url.rb 98 def remote_url=(url) 99 assign_remote_url(url) 100 @remote_url = url 101 end
Used by <name>_data_uri= attachment method.