开发者

Rails 3 Devise problem

I've got strange problem with my project. I have Rails 3 and Devise is up and running, I've added custom route:

match '/users', :to => 'users#index', :as => "all_users", :via => "get"

My rake routes returns this:

marat@rails:~/projects/test$ rake routes | grep users
      new_user_session GET    /users/sign_in(.:format)                           {:action=>"new", :controller=>"devise/sessions"}
          user_session POST   /users/sign_in(.:format)                           {:action=>"create", :controller=>"devise/sessions"}
  destroy_user_session GET    /users/sign_out(.:format)                          {:action=>"destroy", :controller=>"devise/sessions"}
         user_password POST   /users/password(.:format)                          {:action=>"create", :controller=>"devise/passwords"}
     new_user_password GET    /users/password/new(.:format)                      {:action=>"new", :controller=>"devise/passwords"}
    edit_user_password GET    /users/password/edit(.:format)                     {:action=>"edit", :controller=>"devise/passwords"}
                       PUT    /users/password(.:format)                          {:action=>"update", :controller=>"devise/passwords"}
     user_registration POST   /users(.:format)                                   {:action=>"create", :controller=>"devise/registrations"}
 new_user_registration GET    /users/sign_up(.:format)                           {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET    /users/edit(.:format)                              {:action=>"edit", :controller=>"devise/registrations"}
                       PUT    /users(.:format)                                   {:action=>"update", :controller=>"devise/registrations"}
                       DELETE /users(.:format)                                   {:action=>"destroy", :controller=>"devise/registrations"}
     user_confirmation POST   /users/confirmation(.:format)                      {:action=>"create", :controller=>"devise/confirmations"}
 new_user_confirmation GET    /users/confirmation/new(.:format)                  {:action=>"new", :controller=>"devise/confirmations"}
                       GET    /users/confirmation(.:format)                      {:action=>"show", :controller=>"devise/confirmations"}
           user_unlock POST   /users/unlock(.:format)                            {:action=>"create", :controller=>"devise/unlocks"}
       new_user_unlock GET    /users/unlock/new(.:format)                        {:action=>"new", :controller=>"devise/unlocks"}
                       GET    /users/unlock(.:format)                            {:action=>"show", :controller=>"devise/unlocks"}
         user_comments GET    /users/:user_id/comments(.:format)                 {:action=>"index", :controller=>"comments"}
                       POST   /users/:user_id/comments(.:format)                 {:action=>"create", :controller=>"comments"}
      new_user_comment GET    /users/:user_id/comments/new(.:format)             {:action=>"new", :controller=>"comments"}
     edit_user_comment GET    /users/:user_id/comments/:id/edit(.:format)        {:action=>"edit", :controller=>"comments"}
          user_comment GET    /users/:user_id/comments/:id(.:format)             {:action=>"show", :controller=>"comments"}
                       PUT    /users/:user_id/comments/:id(.:format)             {:action=>"update", :controller=>"comments"}
                       DELETE /users/:user_id/comments/:id(.:format)             {:action=>"destroy", :controller=>"comments"}
                 users GET    /users(.:format)                                   {:action=>"index", :controller=>"users"}
                       POST   /users(.:format)                                   {:action=>"create", :controller=>"users"}
              new_user GET    /users/new(.:format)                               {:action=>"new", :controller=>"users"}
             edit_user GET    /users/:id/edit(.:format)                          {:action=>"edit", :controller=>"users"}
                  user GET    /users/:id(.:format)                               {:action=>"show", :controller=>"users"}
                       PUT    /users/:id(.:format)                               {:action=>"update", :controller=>"users"}
                       DELETE /users/:id(.:format)                               {:action=>"destroy", :controller=>"users"}
             all_users GET    /users(.:format)                                   {:controller=>"users", :action=>"index"}

My controller:

class Use开发者_开发问答rsController::SessionsController < Devise::SessionsController

I've got error:

Expected /home/marat/projects/brandbk/app/controllers/users_controller.rb to define UsersController

What I'm doing wrong? How I can add Index action to Devise controller to show all users for example. Thanks.


Change your controller to be just:

class UsersController < ApplicationController

You're currently defining SessionsController rather than UsersController.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜