jeudi 22 avril 2021

How to find url using controller and action of aliased route

I can find the URLs of most routes using url_for as below

url_for(controller: 'main', action: 'index')

But some of the routes in my application are aliased as

resources :car_insurance_leads, :path=>'car-insurance'

So when I try to find the URL for such a route using

url_for(controller: 'car_insurance_leads', action: 'index')

It gives me incorrect route /blog?controller=car_insurance_leads&action=index

Is there a way to find the URL for aliased routes in Rails 3?

Aucun commentaire:

Enregistrer un commentaire