You want to do several things:
1. Create singular resource
2. Change the `edit` path for your controller
As suggested by @sreekanthGS
, you'll firstly be best creating a singular resource. This works in the same way as the resources
method, except it treats your route as a single record; doing away with the index
route etc:
#config/routes.rb
resources :reservations do
resource :car_emission # -> localhost:3000/reservations/1/car_emission
end
Edit
This will create a set of RESTful routes for your car_emission
, but it will still take you to the car_emissions#show
action when you hit the "naked" link
You'll be best doing this:
#config/routes.rb
resources :reservations do
resource :car_emission, except: :show, path_names: { edit: "" }
end
This will take you to the edit
action when you hit the "naked" link