I had this working then came back to my app after a few months now it's broken. I am sure it's a subtle change in a gem somewhere or I am missing something obvious.
In my application controller I have this:
def after_sign_in_path_for(resource)
user_session["company_id"] = current_user.default_company_id
cookies[:login] = { :value => current_user.email, :expires => Time.now + 2.weeks}
dashboard_path
end
If I call user_session["company_id"] later it's nil (current_user.default_company_id works).
If I set user_session["company_id"] = current_user.default_company_id in the code just before where I call user_session["company_id"] to fetch the value it works.
user_sessionand notsession?