从 Android 或 iPhone 接收图像时,我的控制器操作应该如何?
我的图像模型如下:
class Image < ActiveRecord::Base
attr_accessible :user_id, :file_path
belongs_to :user
mount_uploader :file_path, FileUploader
end
当前控制器:
class ImagesController < ApplicationController
protect_from_forgery :except => [:upload]
def upload
user = User.find(params[:user_id])
# I have no idea what else I have to do...
end
end
我怀疑 Carrierwave 如何神奇地将文件保存到服务器,以及我应该在控制器中做什么来接收该帖子。