I have model called Search and a resource named :search. I’d like to name my controller SearchController, rather than SearchesController. But when I initialize an instance of Search, Rails assumes its route has to be “/searches”.
Is there anything I can do to stop this?
This should work:
resources :search, :as => :searchesRoute urls start with
/search, point tosearchcontroller and use default naming convention:The reason for error is that when form has only access to model instance it tries to find a route helper based on pluralized model name. In this case it tried to use
searches_path. Things should work if we keep the default route names and change only urls and controller.Relevant documentation (under “Relying on named routes”)