suport for ActionDispatch::Request::Session as session object
in Rails 4 env['rack.session'] is ActionDispatch::Request::Session object => doesn't respond to #each 2
13: def session
14: parameter_filter = ActionDispatch::Http::ParameterFilter.new(env['action_dispatch.parameter_filter'])
15:
=> 16: binding.pry
17:
18: env_session = begin
19: env['rack.session'].to_hash
20: rescue NoMethodError
21: env['rack.session'] || { }
22: end
23:
24: parameter_filter.filter(env_session)
25: end
[4] pry(#<PartyFoul::IssueRenderers::Rails>)> env['rack.session'].respond_to?(:each)
=> false
[5] pry(#<PartyFoul::IssueRenderers::Rails>)> env['rack.session'].class
=> ActionDispatch::Request::Session
# so :
[6] pry(#<PartyFoul::IssueRenderers::Rails>)> parameter_filter.filter(env['rack.session'])
NoMethodError: undefined method `each' for #<ActionDispatch::Request::Session:0x000000023718e0>
from /home/tomi/.rvm/gems/ruby-2.1.2@validations/gems/actionpack-4.0.9/lib/action_dispatch/http/parameter_filter.rb:51:in `
# but
[7] pry(#<PartyFoul::IssueRenderers::Rails>)> parameter_filter.filter(env['rack.session'].to_hash)
=> {"session_id"=>"df7cf659a9c513ed84a496b747132319 .....
anyone have any opinion on this ?
:+1: We've been experiencing a lot of "silent errors" due to this issue.
We just ran into this.
For posterity, here is how bugsnag solved the same problem (slightly different approach, doesn't use exception handling as flow control):
https://github.com/bugsnag/bugsnag-ruby/pull/152/files
do guys want me to rewrite this to if statements ? or is the exception capturing ok ?
+1