Use the CarrierWave attribute remote_ remote_{name}_url=
for the simplest solution.
b = Blog.new b.title = "a blog" b.body = "some text" b.remote_image_url = 'http://s3.amazonaws.com/Buket_name/..path../thumb_smile.png' b.save
This function is specific to CarrierWave, so if you want to do something similar with another library, use open-uri
from the standard library.
require 'open-uri' image = open('http://s3.amazonaws.com/Buket_name/..path../thumb_smile.png')
Now the image is a Tempfile
that can be used as a file in your Ruby script.
require 'open-uri' image = open('http://s3.amazonaws.com/Buket_name/..path../thumb_smile.png') b = Blog.new b.title = "a blog" b.body = "some text" b.image = image b.save
source share