我正在使用这本书:使用rails第4版进行敏捷Web开发。错误
**SyntaxError in ProductsController#index
C:/Users/******/Ruby Tutorial/depot/app/controllers/products_controller.rb:72: syntax error, unexpected $undefined, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END ...ams.require(:product).permit(:\, :title, :description, :imag... ... ^**
第72行是:
params.require(:product).permit(:\, :title, :description, :image_url, :price)
他们的语法错误了吗?
第72行的代码是:
def product_params
params.require(:product).permit(:\, :title, :description, :image_url, :price)
end
end
任何人都可以帮助解决此问题
答案 0 :(得分:3)
此处的错误是因为您已将:\
添加为允许的参数。你有一个名为\
的参数吗?
答案 1 :(得分:0)
” ... 第76页的每个脚注5 “Windows用户需要将整个命令放在一行,没有反斜杠 ”。
由于您刚刚开始使用,因此最简单的方法是删除整个depot文件夹并重新开始。 ......“