In older version 2.x I was doing something like:
map.resources :jobs, :as => 'vagas'
and this way, I can use jobs_path to create a link to.
But in rails 3, I still can use :as to define an alias, but I cannot use jobs_path anymore, because it forces me to use vagas_path.
So I was wondering if have any way to define an alias and still use the original resource name to create a link.
Rails RESTful Design which creates seven routes all mapping to the user controller. Rails also allows you to define multiple resources in one line.
TIP: If you ever want to list all the routes of your application you can use rails routes on your terminal and if you want to list routes of a specific resource, you can use rails routes | grep hotel . This will list all the routes of Hotel.
In a nested route, the belongs_to (child) association is always nested under the has_many (parent) association. The first step is to add the nested routes like so: In the above Rails router example, the 'index' and 'show' routes are the only nested routes listed (additional or other resources can be added).
resources :jobs, :path => 'vagas' # after the original!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With