Reputation: 192
During execution of the web app it stores values in the session
.
I know that I can get value from it by session[:some_name]
. But I need to get all the values from it, preferable in hash. Is there any way to do it? Thanks.
Upvotes: 3
Views: 6855
Reputation: 8646
Session is not a hash but mimics hash.
You can use keys
and []
to access all elements:
session.keys.each do |key|
p "#{key} => #{session[key]}"
end
or use to_hash
Upvotes: 1