It’s not obvious, but the cookies you are setting in the controller
are in response object, but the ones you are reading in the view are
in the request object.
What this means is you can’t easily read the cookies you set in the
current request (but your code will work for subsequent requests)
To do what you are trying to do, I would not use cookies. Use the
session[:user_id] value to reload a @current_user object on every
request using a before_filter, and then you can use that to display
the info you want.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.