Guest User

Untitled

a guest
Aug 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. OmniAuth Action Controller Error
  2. class AuthenticationsController < ApplicationController
  3.  
  4. def index
  5. @authentications = current_user.authentications if current_user
  6. end
  7.  
  8. def create
  9. auth = request.env["omniauth.auth"]
  10. current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'],auth['uid'])
  11. flash[:notice] = "Authentication successful."
  12. redirect_to authentications_url
  13. end
  14.  
  15. def destroy
  16. @authentication = current_user.authentications.find(params[:id])
  17. @authentication.destroy
  18. flash[:notice] = "Successfully destroyed authentication."
  19. redirect_to authentications_url
  20. end
  21.  
  22. ProjectManage::Application.routes.draw do |map|
  23. match '/auth/:provider/callback' => 'authentications#create'
  24. devise_for :users
  25. resources :projects
  26. resources :tasks
  27. resources :authentications # <-- This is the one you're missing
  28. root :to => 'projects#index'
  29. end
Add Comment
Please, Sign In to add comment