设计宝石的Rake路线错误

时间:2013-03-27 17:14:42

标签: ruby-on-rails ruby-on-rails-3 devise

我的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)>'

1 个答案:

答案 0 :(得分:0)

无需使用作为

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

应该这样做。