Advertisement
mochination

Untitled

Oct 8th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. class UsersController < ApplicationController
  2. before_action :authenticate_user!
  3.  
  4. def show
  5. if current_user
  6. @user = User.find(params[:id])
  7. else
  8. redirect_to '/users/sign_in'
  9. end
  10. end
  11.  
  12. def add_url
  13. @user = current_user
  14. if @user.image_urls.nil?
  15. @user.image_urls = [params[:url]]
  16. else
  17. @user.image_urls.push(params[:url])
  18. end
  19. @my_url = "[" + url + "]"
  20. `python lib/computer_vision.py my_url`
  21. @user.save
  22. redirect_to user_path
  23. end
  24.  
  25. def follow
  26. current_user.follow(Group.find(params[:id]))
  27. redirect_to group_path(params[:id])
  28. end
  29.  
  30. def unfollow
  31. current_user.stop_following(Group.find(params[:id]))
  32. redirect_to group_path(params[:id])
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement