class ActiveStorage::Attached
Public Instance Methods
url_sync(url)
click to toggle source
# File lib/rails_com/active_storage/activestorage_attached.rb, line 7 def url_sync(url) filename = File.basename URI(url).path Tempfile.open do |file| file.binmode HTTPX.get(url).body.each do |fragment| file.write fragment end file.rewind self.attach io: file, filename: filename end end