rails consoleで画像をダウンロードしようとすると、No such file or directoryエラーが発生する
解決
require 'open-uri' open('tmp/image.png', 'wb') do |file| file << open('https://pbs.twimg.com/profile_images/xxx.jpg').read end image_io = open('tmp/image.png') 事象
rails内で下記の処理を行えており、コンソールで同様の処理を実行したところ、NoMethodError: private method open’ called` が発生した。
image_io = URI.parse(image_uri).open openを使用すると、No such file or directory が発生する。
This post is licensed under CC BY 4.0 by the author.