Skip to content

Commit

Permalink
lib/bugsnag/middleware/rack_request: early load session for Rails 4
Browse files Browse the repository at this point in the history
Fixes #144 (Rails 4 sessions appear in custom tab)

Context: rails/rails#10813
  • Loading branch information
kyrylo committed Aug 27, 2014
1 parent fada45e commit 52cf472
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

??????
------

- Fix Rails 4 sessions appearing in Custom tab instead of its own ([144](https://github.com/bugsnag/bugsnag-ruby/issues/144))

2.4.0
-----
- Allow filters to be regular expressions (thanks @tamird)
Expand Down
10 changes: 9 additions & 1 deletion lib/bugsnag/middleware/rack_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ def call(notification)
notification.add_tab(:environment, env)

# Add a session tab
notification.add_tab(:session, session) if session
if session
if session.is_a?(Hash)
# Rails 3
notification.add_tab(:session, session)
elsif session.respond_to?(:to_hash)
# Rails 4
notification.add_tab(:session, session.to_hash)
end
end

# Add a cookies tab
cookies = request.cookies
Expand Down

0 comments on commit 52cf472

Please sign in to comment.