I posted this issue
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
article_controller i have an action named upload:
@article = Article.find(params[:id])
render :nothing => true
this should save a file-upload to article.uploads. I’m using carrierwave
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
article-model using params[:file] in that exact same action and that
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
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]
great before I used the has_many association.
I have no clue what the problem could be.
Can anyone give me a hint?