Is "action" as a input field name forbidden? Because everything works except the assignment of the "action" param.
“action”作为输入字段名称是否被禁止?因为一切都有效,除了“行动”参数的分配。
4 个解决方案
#1
8
because action
, controller
are prohibited words.
因为动作,控制器是禁止的词。
Look around debug params
查看调试参数
--- !map:ActiveSupport::HashWithIndifferentAccess
action: index
controller: main
so you can't use those params. Because they will be REWRITED AUTOMATICALLY
所以你不能使用那些参数。因为它们将被自动重新制作
#2
5
I would suggest NOT using words like action, name, method as field names as they are all attributes of the form tag and are likely to get confused when the form is posted
我建议不要使用像action,name,method这样的单词作为字段名称,因为它们都是表单标签的所有属性,并且在发布表单时可能会感到困惑
#3
2
I agree with jbeynon, I would also say anything that has to do with CRUD(Create, Read, Update, Delete) is protected also.
我同意jbeynon,我也会说任何与CRUD(创建,读取,更新,删除)有关的内容也受到保护。
#4
0
I don't see why this would be invalid. You'd want to avoid conflicting with existing class or method names (e.g. not a good idea to define a method called action
on a controller).
我不明白为什么这会无效。您希望避免与现有的类或方法名称冲突(例如,在控制器上定义一个名为action的方法不是一个好主意)。
everything works except the assignment of the "action" param.
一切都有效,除了“行动”参数的分配。
Does this generate an error? If so, what exactly?
这会产生错误吗?如果是这样,究竟是什么?
#1
8
because action
, controller
are prohibited words.
因为动作,控制器是禁止的词。
Look around debug params
查看调试参数
--- !map:ActiveSupport::HashWithIndifferentAccess
action: index
controller: main
so you can't use those params. Because they will be REWRITED AUTOMATICALLY
所以你不能使用那些参数。因为它们将被自动重新制作
#2
5
I would suggest NOT using words like action, name, method as field names as they are all attributes of the form tag and are likely to get confused when the form is posted
我建议不要使用像action,name,method这样的单词作为字段名称,因为它们都是表单标签的所有属性,并且在发布表单时可能会感到困惑
#3
2
I agree with jbeynon, I would also say anything that has to do with CRUD(Create, Read, Update, Delete) is protected also.
我同意jbeynon,我也会说任何与CRUD(创建,读取,更新,删除)有关的内容也受到保护。
#4
0
I don't see why this would be invalid. You'd want to avoid conflicting with existing class or method names (e.g. not a good idea to define a method called action
on a controller).
我不明白为什么这会无效。您希望避免与现有的类或方法名称冲突(例如,在控制器上定义一个名为action的方法不是一个好主意)。
everything works except the assignment of the "action" param.
一切都有效,除了“行动”参数的分配。
Does this generate an error? If so, what exactly?
这会产生错误吗?如果是这样,究竟是什么?