Rails 3, Devise and custom controller action
- by Johnny Klassy
routes.rb
match 'agencies/stub' => 'agencies#stub', :via => :get
resources :agencies
Here's the rake routes dump
agencies_stub GET /agencies/stub(.:format) {:controller=>"agencies", :action=>"stub"}
agencies GET /agencies(.:format) {:action=>"index", :controller=>"agencies"}
POST /agencies(.:format) {:action=>"create", :controller=>"agencies"}
new_agency GET /agencies/new(.:format) {:action=>"new", :controller=>"agencies"}
edit_agency GET /agencies/:id/edit(.:format) {:action=>"edit", :controller=>"agencies"}
agency GET /agencies/:id(.:format) {:action=>"show", :controller=>"agencies"}
PUT /agencies/:id(.:format) {:action=>"update", :controller=>"agencies"}
DELETE /agencies/:id(.:format) {:action=>"destroy", :controller=>"agencies"}
Devise is setup to have all agenciesroutes only accessible as admin. The call I'm testing with is http://xyz:12345@localhost:3000/agencies/stub but it doesn't authenticate properly, ie, it doesn't recognize it as admin and throws me back to the Devise login page. The creds are a valid admin account. I'm baffled and have no idea why this is happening. Any insights will be much appreciated.