upload_controller
def create
file = @upload.file
content = File.read file
params['content'] = content
end
end
Here params['content']
has proper file content.
book_controller
def create
@book.description = params['content']
@book.save
end
end
But params['content']
in book_controller.rb
returns nil
How can I pass content from upload controller to book controller?
May this work
content = File.read file
redirect_to url_you_want_to_redirect(content: content)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.