[英]rails controller not accepting params from rails tutorial
i'm trying to create a new controller, i'm following the getting started tutorial. 我正在尝试创建新的控制器,正在遵循入门教程。 I've renamed articles to investments for something different.
我已将文章重命名为投资以进行其他操作。 I keep getting the following error relating to my controller
我不断收到与控制器有关的以下错误
myapp/app/controllers/investments_controller.rb:20: syntax error, unexpected ')', expecting keyword_end
The controller looks like this: 控制器如下所示:
class InvestmentsController < ApplicationController
def show
@investment = Investment.new(params.require(:investment).permit(:title, :text))
end
def new
end
def create
@investment = Investment.new
@investment.save
redirect_to @investment
end
private
def investment_params
params.require(:investment).permit(:title, :description))
end
end
I've also added extra strings to the database. 我还向数据库添加了额外的字符串。 Adding them to the params didn't seem to work either
将它们添加到参数似乎也不起作用
您在行尾有双括号
params.require(:investment).permit(:title, :description))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.