Need clarification on rails routes created when a controller is generated

Hello all,

When a controller is generated, rails adds an entry in routes.rb for that controller and action like this.

get ‘monthly_reciept/new’

But it don’t create helper for this route as in this eg:

get ‘login’ => ‘sessions#login’

Using the second route, I can write “login_path” in any view to redirect to login action.

But how can I use the default generated route inside view without customizing ? Surely I cannot give monthly_receipt/new_path right? I cannot find this in rails guides and rake routes doesn’t show any helper for this route because there is no one.

Thank you

I cannot find this in rails guides and rake routes doesn’t show any helper for this route because there is no one.

Sorry.

I copy pasted the route to the end so that I can find quickly but rake seems not to list the helper repeatedly. I found the helper monthly_receipt_new when I scrolled up

You can always use the ‘as’ modifier

get ‘monthly_reciept/new’, as: ‘new_monthly_receipt’

will give you the ability to use new_monthly_receipt_path