Reputation: 12650
I have a boolean ajax setting that I'm updating and after update call the "current_user" var for a flash message--problem is, the current_user in the flash message contains old data (pre update-attribute).
What's the best way to refresh the current_user data without a page reload?
Upvotes: 1
Views: 1258
Reputation:
It's likely that your current_user code looks something like this:
if session[:user_id]
@current_user ||= User.find(session[:user_id])
end
In which case, the cached value would not update after you make the above update—have you tried updating current_user when you make this update so it's available when the flash happens?
Upvotes: 3