I have a controller mounted at the root of an Engine with the same name
module Contacts
class ContactsController < ApplicationController
...
end
end
Contacts::Engine.routes.draw do
root 'contacts#index'
resources :contacts, :path => '/'
end
So I get the expected routes:
root GET / contacts/contacts#index
contacts GET / contacts/contacts#index
POST / contacts/contacts#create
new_contact GET /new(.:format) contacts/contacts#new
edit_contact GET /:id/edit(.:format) contacts/contacts#edit
contact GET /:id(.:format) contacts/contacts#show
However I have a small problem with my Model:
module Contacts
class Contact
include ActiveModel::Model
include ActiveModel::Serialization
...
end
end
Looks like my link_to
insists in using the false url_path, and I am not sure where I can fix the relationship between my model and the url helpers of my controller:
link_to 'Edit', [:edit, @contact]
NoMethodError: undefined method `edit_contacts_path' for #<#<Class:0x007fc421e17e08>:0x007fc41ca4c8f0>
Why is the plural form for the :edit
path being used?