I think the proper place to put such a patch is in a file inside config/initializers
, i.e. config/initializers/open_uri_allow_unsafe_redirects_patch.rb
. You have to require 'open-uri'
before reopening the OpenURI
module:
require 'open-uri'
module OpenURI
# the rest of the file here...
end
Then you have to call open
passing the option allow_unsafe_redirects
set to true
:
open('http://api.twitter.com/1/users/profile_image/barackobama.png?size=bigger',
allow_unsafe_redirects: true)
You can find more informations about initializer files on the Ruby on Rails guide