Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is "action" as a input field name forbidden? Because everything works except the assignment of the "action" param.

like image 202
Mario Uher Avatar asked Jan 12 '11 17:01

Mario Uher


People also ask

What does Param required mean?

The params in a controller looks like a Hash, but it's actually an instance of ActionController::Parameters , which provides several methods such as require and permit . The require method ensures that a specific parameter is present, and if it's not provided, the require method throws an error.

What is Param Ruby?

In HTTP/HTML, the params are really just a series of key-value pairs where the key and the value are strings, but Ruby on Rails has a special syntax for making the params be a hash with hashes inside. For example, if the user's browser requested.

What does Param mean in Java?

The PARAM element is used to provide "command-line" arguments to a Java applet, which is embedded in a document with the APPLET element. It has two attributes: NAME specifies the name of the argument, and VALUE specifies the value for this argument.


2 Answers

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

like image 161
fl00r Avatar answered Oct 22 '22 21:10

fl00r


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

like image 29
John Beynon Avatar answered Oct 22 '22 23:10

John Beynon