Take the 2-minute tour ×

by copying and trying to modify a scaffold manually in Rails 4, I got an error when I want to delete an article: "uninitialized constant Article::Tag". Another error when I want to edit an Article: "undefined local variable or method `article_params'".

I don't know from where it can comes from, the highlited error which are displayed are "@article.destroy" and "if @article.update(article_params)". I don't understand at all considering I think having copied perfectely the scaffold...

def destroy
  respond_to do |format|
    format.html { redirect_to articles_url }
    format.json { head :no_content }

def update
  respond_to do |format|
    if @article.update(article_params)
      format.html { redirect_to @article, notice: 'Article was successfully updated.' }
      format.json { head :no_content }
      format.html { render action: 'edit' }
      format.json { render json: @article.errors, status: :unprocessable_entity }

Thansk you for your help

share|improve this question
The problem is in your Article model, I believe –  MikDiet Jan 11 '13 at 15:01
Thanks, It was the solution, I haven't think about the model at all! The destroy wasn't working because of the "has_and_belongs_to_many" And the editing problem wasn't working because of the "validates_presence_of" –  sidney Jan 11 '13 at 15:08

Your Answer



Browse other questions tagged or ask your own question.