Try this:
require 'open-uri'
open('image.png', 'wb') do |file|
file << open('http://example.com/image.png').read
end
More Related Contents:
- Explain like I'm LITERALLY five…what does it mean to "format" a string? [closed]
- Convert string to XXX
- How to change default timezone for Active Record in Rails?
- How to avoid NoMethodError for missing elements in nested hashes, without repeated nil checks?
- Understanding the Rails Authenticity Token
- Rails :include vs. :joins
- What is the best method of handling currency/money?
- Installing Bootstrap 3 on Rails App
- Rails 4 Authenticity Token
- Rails 5: ActiveRecord OR query
- Rails: What’s a good way to validate links (URLs)?
- ruby-debug with Ruby 1.9.3?
- How do I wrap link_to around some html ruby code?
- POST json to rails server
- Getting fields_for and accepts_nested_attributes_for to work with a belongs_to relationship
- How to match accented characters with a regex?
- ‘require’: cannot load such file — ‘nokogiri\nokogiri’ (LoadError) when running `rails server`
- What are the brackets [5.1] after ActiveRecord Migration and how does it work? [duplicate]
- f.error_messages in Rails 3.0
- how to read a User uploaded file, without saving it to the database
- Convert UTC to local time in Rails 3
- Rails Paperclip how to delete attachment?
- Rails Migrations: tried to change the type of column from string to integer
- String.force_encoding() in Ruby 1.8.7 (or Rails 2.x)
- What is the difference between pluck and collect in Rails?
- Looking for suggestions for building a secure REST API within Ruby on Rails
- Installing Ruby on Rails – Mac OS Lion
- Ruby: Create range of dates
- Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?
- Unable to install MySQL2 gem on Windows 7