mardi 29 août 2017

NameError in ArticlesController#create undefined local variable or method `article_params' for #

I am getting this error when I create my articles:

error: NameError in ArticlesController#create undefined local variable or method `article_params' for # Did you mean? article_path

image of error : enter image description here

my code :

class ArticlesController < ApplicationController

   def new
     @article = Article.new 
   end
   def create
  @article = Article.new(article_params)


 if  @article.save
  flash[:notice] = "Article was submitted succsefully"
  redirect_to (@article)
else
   render :new
 end 

    private 
    def article_params 
       params.require(:article).permit(:title, :description)

    end





   end




end 

Aucun commentaire:

Enregistrer un commentaire