How do I conditionally assign ruby variables to javascript variables?
- by Tony
I have a website where I need a javascript version of the "current user" object along with the ruby version. I have been assigning these variables doing something like this...
Application Controller:
def get_user
begin
@current_user = User.find(session[:user_id]) if session[:user_id]
@current_user_json = @current_user.to_json
…