Guest User

Untitled

a guest
May 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def action
  2. u = User.new
  3. # do something...
  4. u.save
  5. cookies["user_id"] = u.id
  6. session["new_user"] = u.id
  7. end
  8.  
  9. def action2
  10. u = User.find_by_id( cookies["user_id"] )
  11.  
  12. if u.nil?
  13. user_id = session["new_user"]
  14.  
  15. unless user_id.nil?
  16. # new user...
  17. end
  18. end
  19. # do something...
  20. end
Add Comment
Please, Sign In to add comment