开发者

Why can't I use a param called "action"?

开发者 https://www.devze.com 2023-02-03 17:04 出处:网络
Is \"action\" as a input field name forbidden? Because everything works except the assignment of th开发者_如何学Goe \"action\" param.because action, controller are prohibited words.

Is "action" as a input field name forbidden? Because everything works except the assignment of th开发者_如何学Goe "action" param.


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


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


I agree with jbeynon, I would also say anything that has to do with CRUD(Create, Read, Update, Delete) is protected also.


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).

everything works except the assignment of the "action" param.

Does this generate an error? If so, what exactly?

0

精彩评论

暂无评论...
验证码 换一张
取 消