Is "action" as a input field name forbidden? Because everything works except the assignment of the "action" param.
Asked
Active
Viewed 2,112 times
4 Answers
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

fl00r
- 82,987
- 33
- 217
- 237
-
If it's a POST request, here's the way to go: https://stackoverflow.com/questions/30207671/rails-action-params-key-conflict – DTrejo Sep 02 '21 at 03:11
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

John Beynon
- 37,398
- 8
- 88
- 97
2
I agree with jbeynon, I would also say anything that has to do with CRUD(Create, Read, Update, Delete) is protected also.

Scott Radcliff
- 1,501
- 1
- 9
- 13
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).
everything works except the assignment of the "action" param.
Does this generate an error? If so, what exactly?

zetetic
- 47,184
- 10
- 111
- 119