class ArticlesController < ApplicationController
def index
@articles = Article.all
end
def show
@article = Article.find(params[ :id])
end
def new
@article = Article.new
end
def create
@article = Article.new(article_params)
if @article.save
redirect_to @article
else
render 'new'
end
end
private
def article_params
params.require(:article).permit(:Article_name,:enter_text)
end
end
答案 0 :(得分:1)
尝试:
..... .permit(:name, :enter_text)
答案 1 :(得分:0)
您需要省略类名,只需指定值名称。 请参阅下面的示例。
private
def article_params
params.require(:article).permit(:name, :enter_text)
end