2013-08-07 3 views
-1

나는 omniauth 및 devise 보석을 추가하고 페이스 북 로그인 지원을 추가하고있었습니다. 이것은 내 routes.rb 파일입니다.레일 라우팅 문제 4 응용

resources :authentications do 
    match 'auth/:provider/callback' => 'authentications/#create', :via => :post 
end 

나는 비아 부분에 들어가기 위해서뿐만 아니라 게시도 시도했습니다. 다음은 인증 컨트롤러 용 컨트롤러입니다. 여기

def create 
    auth = request.env["rack.auth"] 
    current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid']) 
    flash[:notice] = "Authentication successful." 
    redirect_to authentications_url 
end 

이것은

match 'auth/:provider/callback' => 'authentications/#create', :via => :post 

이어야한다 레이크 출력 경로를

레이크 노선

   authentications GET /authentications(.:format)      authentications#index 
           POST /authentications(.:format)      authentications#create 
      new_authentication GET /authentications/new(.:format)     authentications#new 
      edit_authentication GET /authentications/:id/edit(.:format)   authentications#edit 
       authentication GET /authentications/:id(.:format)     authentications#show 
           PUT /authentications/:id(.:format)     authentications#update 
           DELETE /authentications/:id(.:format)     authentications#destroy 
        conferences GET /conferences(.:format)       conferences#index 
           POST /conferences(.:format)       conferences#create 
       new_conference GET /conferences/new(.:format)      conferences#new 
       edit_conference GET /conferences/:id/edit(.:format)    conferences#edit 
        conference GET /conferences/:id(.:format)      conferences#show 
           PUT /conferences/:id(.:format)      conferences#update 
           DELETE /conferences/:id(.:format)      conferences#destroy 
         profiles GET /profiles(.:format)       profiles#index 
           POST /profiles(.:format)       profiles#create 
        new_profile GET /profiles/new(.:format)      profiles#new 
        edit_profile GET /profiles/:id/edit(.:format)     profiles#edit 
         profile GET /profiles/:id(.:format)      profiles#show 
           PUT /profiles/:id(.:format)      profiles#update 
           DELETE /profiles/:id(.:format)      profiles#destroy 
           GET /conferences(.:format)       conferences#index 
           POST /conferences(.:format)       conferences#create 
           GET /conferences/new(.:format)      conferences#new 
           GET /conferences/:id/edit(.:format)    conferences#edit 
           GET /conferences/:id(.:format)      conferences#show 
           PUT /conferences/:id(.:format)      conferences#update 
           DELETE /conferences/:id(.:format)      conferences#destroy 
activity_bigbluebutton_server GET /bigbluebutton/servers/:id/activity(.:format) bigbluebutton/servers#activity 
    rooms_bigbluebutton_server GET /bigbluebutton/servers/:id/rooms(.:format)  bigbluebutton/servers#rooms 
     bigbluebutton_servers GET /bigbluebutton/servers(.:format)    bigbluebutton/servers#index 
           POST /bigbluebutton/servers(.:format)    bigbluebutton/servers#create 
     new_bigbluebutton_server GET /bigbluebutton/servers/new(.:format)   bigbluebutton/servers#new 
    edit_bigbluebutton_server GET /bigbluebutton/servers/:id/edit(.:format)  bigbluebutton/servers#edit 
      bigbluebutton_server GET /bigbluebutton/servers/:id(.:format)   bigbluebutton/servers#show 
           PUT /bigbluebutton/servers/:id(.:format)   bigbluebutton/servers#update 
           DELETE /bigbluebutton/servers/:id(.:format)   bigbluebutton/servers#destroy 
    external_bigbluebutton_rooms GET /bigbluebutton/rooms/external(.:format)  bigbluebutton/rooms#external 
           POST /bigbluebutton/rooms/external(.:format)  bigbluebutton/rooms#external_auth 
     join_bigbluebutton_room GET /bigbluebutton/rooms/:id/join(.:format)  bigbluebutton/rooms#join 
    running_bigbluebutton_room GET /bigbluebutton/rooms/:id/running(.:format)  bigbluebutton/rooms#running 
     end_bigbluebutton_room GET /bigbluebutton/rooms/:id/end(.:format)   bigbluebutton/rooms#end 
    invite_bigbluebutton_room GET /bigbluebutton/rooms/:id/invite(.:format)  bigbluebutton/rooms#invite 
join_mobile_bigbluebutton_room GET /bigbluebutton/rooms/:id/join_mobile(.:format) bigbluebutton/rooms#join_mobile 
           POST /bigbluebutton/rooms/:id/join(.:format)  bigbluebutton/rooms#auth 
      bigbluebutton_rooms GET /bigbluebutton/rooms(.:format)     bigbluebutton/rooms#index 
           POST /bigbluebutton/rooms(.:format)     bigbluebutton/rooms#create 
     new_bigbluebutton_room GET /bigbluebutton/rooms/new(.:format)    bigbluebutton/rooms#new 
     edit_bigbluebutton_room GET /bigbluebutton/rooms/:id/edit(.:format)  bigbluebutton/rooms#edit 
      bigbluebutton_room GET /bigbluebutton/rooms/:id(.:format)    bigbluebutton/rooms#show 
           PUT /bigbluebutton/rooms/:id(.:format)    bigbluebutton/rooms#update 
           DELETE /bigbluebutton/rooms/:id(.:format)    bigbluebutton/rooms#destroy 
             /auth/:provider/callback(.:format)    authentications/#create 
          root  /           profiles#new 
       new_user_session GET /users/sign_in(.:format)      devise/sessions#new 
        user_session POST /users/sign_in(.:format)      devise/sessions#create 
      destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy 
       user_password POST /users/password(.:format)      devise/passwords#create 
      new_user_password GET /users/password/new(.:format)     devise/passwords#new 
      edit_user_password GET /users/password/edit(.:format)     devise/passwords#edit 
           PUT /users/password(.:format)      devise/passwords#update 
     cancel_user_registration GET /users/cancel(.:format)      devise/registrations#cancel 
      user_registration POST /users(.:format)        devise/registrations#create 
     new_user_registration GET /users/sign_up(.:format)      devise/registrations#new 
     edit_user_registration GET /users/edit(.:format)       devise/registrations#edit 
           PUT /users(.:format)        devise/registrations#update 
           DELETE /users(.:format)        devise/registrations#destroy 

답변

1

이다

match 'auth/:provider/callback' => 'authentications#create', :via => :post 
,745,

여기서 authentications은 컨트롤러입니다. & create은 방법입니다.