Rails 3, Devise and custom controller action

Posted by Johnny Klassy on Stack Overflow See other posts from Stack Overflow or by Johnny Klassy
Published on 2011-11-15T01:45:02Z Indexed on 2011/11/15 1:52 UTC
Read the original article Hit count: 196

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.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-3