Guest User

Untitled

a guest
Nov 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class ContactsController < ApplicationController
  2.  
  3. def create
  4. @contact = current_user.contacts.create(contact_id: params[:contact_id])
  5. respond_ok
  6. end
  7.  
  8. def update
  9. @contact = Contact.find_by_users(params[:id], current_user.id)
  10. @contact.update(accepted: true)
  11. respond_ok
  12. end
  13.  
  14. def destroy
  15. @contact = Contact.find(params[:id])
  16. @contact.destroy
  17. respond_ok
  18. end
  19.  
  20. private
  21.  
  22. def respond_ok
  23. respond_to do |format|
  24. format.json { head :ok }
  25. end
  26. end
  27.  
  28. end
Add Comment
Please, Sign In to add comment