1

我的 routes.rb 看起来像这样。

devise_for :users, :skip => [:sessions]
as :user do
  get 'signin' => 'devise/sessions#new', :as => :new_user_session
  post 'signin' => 'devise/sessions#create', :as => :user_session
  delete 'signout' => 'devise/sessions#destroy', :as => :destroy_user_session
end

当我运行时rake routes出现错误

undefined method `as' for #<ActionDispatch::Routing::Mapper:0xa954f20>
/home/ramkishan/vijay_work/kirana/config/routes.rb:4:in `block in <top (required)>'
4

1 回答 1

0

无需使用as

devise_for :users, :skip => [:sessions] do
  get '/signin'   => "devise/sessions#new",       :as => :new_user_session
  post '/signin'  => 'devise/sessions#create',    :as => :user_session
  get '/signout'  => 'devise/sessions#destroy',   :as => :destroy_user_session
end

应该做。

于 2013-03-27T19:28:27.610 回答