2013-01-07 1 views
0

등록 :고안 내가 이것이다 설정 유증에 대한 사용자 정의 등록 컨트롤러,이 컨트롤러

devise_for :users, controllers: {registrations: "registrations"} 

와 컨트롤러 :

class RegistrationsController < Devise::RegistrationsController 

    protected 

    def after_update_path_for(resource) 
     user_path(resource) 
    end 
end 

그것은 작동을 큰.

그러나 나는 또한 그 자체로 다시 좋은 작품 omniauth 인증, ...이 : 당신은 아마 이미 내 문제를 볼 수 있습니다 그러나

devise_for :users, controllers: {omniauth_callbacks: "omniauth_callbacks"} 
class OmniauthCallbacksController < Devise::OmniauthCallbacksController 

    def all 
    user = User.from_omniauth(request.env["omniauth.auth"]) 
     if user.persisted? 
     flash.notice = "Signed in!" 
     sign_in_and_redirect user 
     else 
     session["devise.user_attributes"] = user.attributes 
     redirect_to sign_up_path 
     end 
    end 
    alias_method :linkedin, :all 
    alias_method :twitter, :all 

end 

- 내가 그들을 함께 작동하도록하는 방법을 잘 모르겠어요 , 둘 다 'devise_for : users'로 시작하고 라우트 파일에 둘 중 어느 쪽을 사용하든 하나는 작동하지 않습니다.

옴니 오트 _ 콜백 컨트롤러가 인증을 처리하는 동안 등록 컨트롤러가 '편집'및 '업데이트'작업 만 덮어 쓸 수 있도록 둘 다 어떻게 동시에 작동시킬 수 있습니까?

감사

답변

2

routes.rb에서, 당신은이 같은 devise_for에 대한 쉼표로 분리 된 경로를 넣을 수 있습니다 -이 작동

devise_for :users, controllers: {registrations: "registrations", omniauth_callbacks: "omniauth_callbacks"} 

.

+0

Brilliant, thanks Saurabh, 완벽하게 작동합니다! – jfdimark

관련 문제