Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only use Rails.version if it is defined #660

Merged
merged 2 commits into from
Feb 7, 2017
Merged

Conversation

penguincoder
Copy link
Contributor

This is an interesting situation.

I am writing a Grape API application using only Rack, however, I am using ActionMailer to send some emails in Sidekiq. Something inside one of the Action* gems is defining the module Rails, but it's not fully loaded, as I am not using Rails. So when Airbrake gets to the point where it wants to use the context filter, it fails because version is not defined in the Rails module.

This code just checks to see if version is a defined attribute or method of the module Rails.

@@ -7,7 +7,7 @@ module Rack
class ContextFilter
def initialize
@framework_version =
if defined?(::Rails)
if defined?(::Rails) and ::Rails.respond_to?(:version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop will probably reject and. We use && in this project.

@kyrylo
Copy link
Contributor

kyrylo commented Feb 2, 2017

For some reason Circle didn't run tests for this PR. Could you fix #660 (comment), it will restart the tests.

@kyrylo kyrylo merged commit 2a6f47a into airbrake:master Feb 7, 2017
kyrylo added a commit that referenced this pull request Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants