这里有一个控制器
require 'open-uri'
user = User.new
url = "some_remote_image.jpg" #remote image WITH extension
user.image = open(url)
user.save
模型
has_attached_file :image,
:styles => { :thumb => "25x25>", :large => "1000x1000>" },
:path => ":rails_root/images/users/:id/:style/:hash.:extension",
:url => "/images/users/:id/:style/:hash.:extension",
:hash_secret => "hash string"
这个方法可以工作,但图像没有扩展名,比如“some_remote_image.” 如果通过表单上传图像,则所有内容都将包含扩展名。 我有点困惑。