That was the problem, thanks a lot! I changed it to

@upload = Upload.new
@upload.file = params[:file]
@upload.save!
@article.uploads << @upload

works like a charm. @upload.file = params[:file] works because I'm using 
carrierwave to manage uploads.

However, I'm wondering how you have to write your constructor to be able to 
pass the file when instantiating the model. I mean like this:

@upload = Upload.create(params[:file])

This didn't work:

def initialize (f)
  @file = f
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to