1

我知道这个问题很简单,但我还不能解决。可能你们的眼睛比我还敏锐。

我有select_tag哪个:

<%= f.select :product_type, options_for_select([["Raw Material", "0"], ["Semi Material", "1"], ["Finish", "2"]], @product.product_type,), { :prompt => "Select Product Type" }, :required => true %>

一个简单select_tag但它总是返回wrong number of arguments (0 for 1)

我尝试从我的另一个select_tag非常相似的页面复制粘贴,并在它的页面上完美运行,但仍然在此页面上返回该错误。

我尝试将代码破坏为:

33. <%= f.select :product_type, options_for_select([["Raw Material", "0"],
34. ["Semi Material", "1"],
35. ["Finish", "2"]], 
36. @product.product_type,
37. ), { :prompt => "Select Product Type" }, :required => true %>

它在行上返回错误36

我不知道为什么让它不起作用。谢谢

4

2 回答 2

1

我在模型上的错误是我创建了一个在该字段上具有相同名称的过程。所以这就是为什么它总是在我的模型上返回错误原因def product_type(id)

真的很抱歉,谢谢

于 2013-02-28T07:55:11.313 回答
0

您可以尝试删除第 36 行末尾的逗号。

于 2013-02-28T07:49:30.143 回答