Rails(使用rails第4版进行敏捷Web开发)Controller中的语法错误(products_controller)

时间:2013-12-04 15:23:18

标签: ruby-on-rails ruby-on-rails-3

我正在使用这本书:使用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

任何人都可以帮助解决此问题

2 个答案:

答案 0 :(得分:3)

此处的错误是因为您已将:\添加为允许的参数。你有一个名为\的参数吗?

答案 1 :(得分:0)

” ... 第76页的每个脚注5 “Windows用户需要将整个命令放在一行,没有反斜杠 ”。

由于您刚刚开始使用,因此最简单的方法是删除整个depot文件夹并重新开始。 ......“

same case here

相关问题