dwilkie/carrierwave_direct — Issue #5: Upload within a model form
Author: rapcal
Created: 2011-10-24 20:30:59+00:00
State: open

I'm not sure if this is the place for questions, so please delete it if innapropriate. I just couldn't find a forum or another place that seemed better suited.

I'm uploading a user avatar with carrierwave, which works inside a regular form_for. So I get the avatar along with all the rest of the user info.

However, with carrierwave_direct, something like this would not work, since I would need to nest the direct_upload_form_for inside a form_for. Something like this:

´´´ruby

<%= form_for @user, :html => { :multipart => true } do |f| %>
<%= f.error_messages %>

<%= f.label "What's your name?" %>

<%= f.text_field :name %>

<%= f.label "What's your birthday?" %>

<%= f.date_select :birthday %>

<%= direct_upload_form_for @uploader do %>
<%= f.label "Upload your avatar" %>

<%= f.file_field :avatar %>
<%= f.submit %>
<% end %>

´´´

Anyway to get around this? I would really love to avoid a flash uploader.

Thanks for the great gem! Hope I'm able to get it working on my scenario.