Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <%= link_to "Cancel Invitation", remove_user_invitation_path(invitation_token: invited.invitation_token), confirm: "Are you sure?", class: 'btn btn-mini btn-danger' %>
  2.  
  3. Started GET "/invitation/remove?invitation_token=f4e26062f27c7cc32a60e2024b9dba2b1350abba" for 127.0.0.1 at 2013-10-28 15:07:44 -0700
  4. Processing by Devise::InvitationsController#destroy as HTML
  5. Parameters: {"invitation_token"=>"f4e26062f27c7cc32a60e2024b9dba2b1350abba"}
  6. User Load (2.9ms) SELECT "users".* FROM "users" WHERE "users"."invitation_token" = '46488d68fb36387ec639d5d6b9749273b56561a944f76eeefb2f5294ea5225e6' LIMIT 1
  7.  
  8. class InvitationsController < ApplicationController
  9. ...
  10.  
  11. before_filter :user_from_invitation_token
  12.  
  13. def remove
  14. User.destroy(@user.id)
  15. flash[:notice] = 'Invitation removed'
  16. redirect_to company_users_path
  17. end
  18.  
  19. private
  20.  
  21. def user_from_invitation_token
  22. unless params[:invitation_token] && @user = @company.invited_users.where(invitation_token: params[:invitation_token]).first
  23. flash[:error] = 'Invitation not found'
  24. redirect_to company_users_path
  25. end
  26. end
  27. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement