2012-01-14 10 views
1

私が抱えている問題は、Deviseが_#{role}を認証しているようです。メソッドが私の登録の試みをハイジャックしています。authenticate_user!登録をハイジャックしてメソッドを作成する

Started GET "/client/sign_up" for 127.0.0.1 at 2012-01-14 12:02:52 +0000 
    Processing by Client::RegistrationsController#new as HTML 
Rendered /Users/robertwwhite/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.3/app/views/devise/shared/_links.erb (1.4ms) 
Rendered client/registrations/new.html.haml within layouts/application (97.6ms) 
Rendered client/_navigation.html.haml (1.6ms) 
Rendered shared/_flash_messages.html.haml (0.1ms) 
Completed 200 OK in 126ms (Views: 116.4ms | ActiveRecord: 7.2ms) 

Started POST "/client" for 127.0.0.1 at 2012-01-14 12:02:58 +0000 
    Processing by WishesController#index as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"vq3wgsQeb4eoxhb3sw2Q2kd4edIoOxIfrzJ/WzJUAn0=", "client"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"} 
Completed 401 Unauthorized in 13ms 

Started GET "/client/sign_in" for 127.0.0.1 at 2012-01-14 12:02:58 +0000 
    Processing by Client::SessionsController#new as HTML 
Rendered /Users/robertwwhite/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.3/app/views/devise/shared/_links.erb (1.0ms) 
Rendered client/sessions/new.html.haml within layouts/application (16.5ms) 
Rendered client/_navigation.html.haml (1.5ms) 
Rendered shared/_flash_messages.html.haml (0.3ms) 
Completed 200 OK in 60ms (Views: 38.6ms | ActiveRecord: 6.4ms) 

私はafter_signup_path_for(resource_or_scope)をオーバーライドしようとしましたが、無視なっているようです。

# app/controllers/application_controller.rb 
def after_sign_up_path_for(resource_or_scope) 
    random_path 
end 

したがって、ユーザーは最初にサイトに登録できません。何か案は?

答えて

2

あなたのルートがデフォルトのルート/メソッドをオーバーライドしていないことを確認しましたか?

は、同様の問題を持つユーザーを明確にするためにハール編:

私は私のdevise_for方法上記の私のconfig/routes.rbをして、次のいました。以下にそれを移動することにより考案の

devise_for :clients, :path => :client 

をオーバーライドして

match "client" => "wishes#index" 

、それは工夫の優先度を与え、まだPOSTリクエストをハイジャックすることなく、適切なコントローラとアクションにGETリクエストを渡します。

関連する問題