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

Check Rails is defined before referring to Rails #1145

Open
bazay opened this issue Jul 1, 2021 · 0 comments
Open

Check Rails is defined before referring to Rails #1145

bazay opened this issue Jul 1, 2021 · 0 comments

Comments

@bazay
Copy link

bazay commented Jul 1, 2021

defined?(ActionDispatch::Reloader) && Rails.application.config.cache_classes == false

We are running a rack application (not Rails) that uses DelayedJob as well as loads in ActionDispatch i.e.

spec.add_dependency 'actionpack'
spec.add_dependency 'delayed_job'
...
require 'action_dispatch'
require 'delayed_job'

The linked line of code causes our application to blow up because the Rails class is not defined.

Is there a reason why this is checking ActionDispatch::Reloader and not the Rails class constant itself?

Perhaps it should check both are defined?

@bazay bazay changed the title Don't check for ActiveDispatch when using Rails class name Check Rails is defined before referring to Rails Jul 1, 2021
bazay added a commit to bazay/delayed_job that referenced this issue Jul 1, 2021
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

No branches or pull requests

1 participant