The idea is:
Controller receives the results in the callback, as expected.
# controller callback, saves result to session
# this method is executed as expected
# session id matches the one from other controller actions
def on_counter_value_calculated(context, new_value)
@counter = new_value
session[:counter] = @counter
end
However, stored session is lost in subsequent calls.
# although the same session is targeted (same id)
# the saved value is not the same
def index
@counter = session[:counter] || 0
end
I've created a small Rails project that demonstrates the issue:https://github.com/elvanja/controller_callbak_store_in_session
Any input appreciated.