I’m pretty much of a rails newbie and ss the title says I’m failing at
Anyway. I have 2 models ‘article’ and ‘upload’. Article has_many
Now I’m trying to create an instance of upload in an article in my
articles_controller like this:
class ArticlesController < ApplicationController
@article = Article.find(params[:id])
render :nothing => true
If I submit a file to articles/1/upload I get 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])
Does anyone have an idea what’s wrong?