Ruby on rails guiding method

What is the best way to route the new method so that it can be called like this:

method_users_path

Users is a model, a method is a new method that I created, to which I want to bind.

Thanks, Muki

+3
source share
2 answers

If you do with rails 3, you may have something similar on your routes.

resource :users do
    match "method", :on => :collection
end

this will create you method_users_path. Alternatively, you can use post / get instead of matching if you want to be a specific type of request. Learn more about rails routing here.

Update

:collection, . , - , - . , users_path

:member, , , edit_user_path(@user), .

0

, , - map.resources :users, :collection => {:something => :get}, , somthing_users_path (Rails2) e

0

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


All Articles