Reputation: 24886
I have a search form in the header of my site, such as this:
=semantic_form_for :search, :url=>{:controller=>:listings,:action=>:search} do
...
This works fine except when the controller for the current page is scoped or namespaced -- not sure which. For example, '/users/sign_in' page is controlled by Devise and its controller is inside Devise namespace.
On that page, I get an error message that indicates that the action does not exist under Devise::Listings controller. (Of course it does not, because Listings controller is not in the Devise namespace.)
How do I make sure that url helper does not automatically prefix the namespace of the controller for the current page?
Upvotes: 0
Views: 642
Reputation: 2636
Try using a named route.
controller 'listings' do
get 'search', :as => :listings_search
end
=semantic_form_for :search, :url => listings_search_path do
Upvotes: 2