Is it possible in Rails3, to have a multipart form => true & use remote => true
I'm using the following form tag for @jobs which 开发者_如何转开发have job_photos included.
<% form_for @jobs, :html => { :multipart => true }, :remote => true do |f| %>
The form works fine non-remote, but if I add the remote = > true, the form submits, returns create.js but doesn't save anything to the DB or error?
The thing is that you cannot post a multipart form via AJAX. This is not a rails' limitation. In order to circumvent this, you need to use an iframe technique (which can be easier with responds_to_parent plugin) or use a technology like Flash or Silverlight.
You can use Remotipart gem for file uploads with remote
=> true
.
精彩评论