Hi there,

I posted this issue 
<https://groups.google.com/forum/?hl=de#!topic/carrierwave/ergk9LaO68k>at 
the carrierwave-group, but I'm beginning to think this rather is a 
rails-issue than a problem with carrierwave. The problem's this:

I have 2 models, 'article' and 'upload'. article has_many :uploads. In my 
article_controller i have an action named upload:

def upload
  @article = Article.find(params[:id])
  @article.uploads.create(params[:file])
  render :nothing => true
end

this should save a file-upload to article.uploads. I'm using carrierwave to 
save uploads in the upload-model, but that's probably not the problem. 
Before I created the has_many-association I saved the upload directly in the 
article-model using params[:file] in that exact same action and that worked 
great.
Now that I created the association there seems to be a problem with 
params[:file]. I keep getting a NoMethodError:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.delete

app/controllers/articles_controller.rb:95:in `upload'

where line 95 is @article.uploads.create(params[:file])

if I remove the parameter no errors get thrown. But the console tells me 
params[:file] DOES exists and has proper values. Also params[:file] worked 
great before I used the has_many association.

I have no clue what the problem could be.

Can anyone give me a hint?
Thanks,
Lukas

-- 
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