How to add a new action to an already created controller?

I use rails and I need to know how to add a new action to my controller, new to rails, so I really don’t know if I can just type “def action” in controller.rb or is it too much of that?

Thanks.

+3
source share
3 answers

No, that ... just adding a method to a controller class automatically creates a new action for that controller (at least with a default setting).

Beginning Ruby on Rails . , , " " " " . .

+3

, , . :

map.connect ':controller/:action/:id'

(. ActionController:: Routing).

RESTful, ( ) routes.rb(. ActionController:: Resources).

+2

, , , . .

, :

views/main/index
+1

Source: https://habr.com/ru/post/1707633/


All Articles