Reputation: 968
I have a problem with adding name to route link.
Below there is screen of routing:
I want to name last link:
GET /backend/people/:id/vacations/new(.:format)
What I tried:
resources :vacations, only: [:new, :create] do
collection do
get 'new', as: 'people_vacation'
end
end
Unfortunately this code duplicates new action.
How to avoid this duplication and have only one link(with name) to new action?
Upvotes: 2
Views: 86
Reputation: 916
I guess you should update your definition to:
resources :vacations, only: [:create] do
collection do
get 'new', as: 'people_vacation'
end
end
This way, "new" action won't be replicated
Upvotes: 6