upload_controller
def create
file = @upload.file
content = File.read file
params['content'] = content
end
end
此处params['content']
具有适当的文件内容。
book_controller
def create
@book.description = params['content']
@book.save
end
end
但params['content']
中的book_controller.rb
会返回nil
如何将内容从上传控制器传递到图书管理员?
答案 0 :(得分:0)
愿这项工作
content = File.read file
redirect_to url_you_want_to_redirect(content: content)