method_for_action
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-38)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (-20)
- 4.2.1 (18)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (7)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
method_for_action(action_name)
private
Takes an action name and returns the name of the method that will handle the action. In normal cases, this method returns the same name as it receives. By default, if #method_for_action receives a name that is not an action, it will look for an #action_missing method and return “_handle_action_missing” if one is found.
Subclasses may override this method to add additional conditions that should be considered an action. For instance, an HTTP controller with a template matching the action name is considered to exist.
If you override this method to handle additional cases, you may also provide a method (like _handle_method_missing) to handle the case.
If none of these conditions are true, and method_for_action returns nil, an AbstractController::ActionNotFound exception will be raised.
Parameters
-
action_name - An action name to find a method name for
Returns
-
string - The name of the method that handles the action
-
nil - No method name could be found.