Skip to content

Conversation

0robustus1
Copy link

Description of changes

Rails apps can run in API only mode, which means they do not have an asset pipeline. If one tries to call config.assets for an app like that one gets the following crash:

NoMethodError: undefined method 'assets' for an instance of Rails::Application::Configuration (NoMethodError)
Did you mean?  asset_host
my-app/config/environment.rb:7:in '<main>'
/bundle:25:in 'Kernel#load'
bundle:25:in '<main>'

The code a few lines above (95-100) (ref) is already written defensively. This does the same for this invocation of config.assets.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Rails apps can run in API only mode, which means they do not
have an asset pipeline. If one tries to call config.assets for
an app like that one gets the following crash:

```
NoMethodError: undefined method 'assets' for an instance of Rails::Application::Configuration (NoMethodError)
Did you mean?  asset_host
my-app/config/environment.rb:7:in '<main>'
/bundle:25:in 'Kernel#load'
bundle:25:in '<main>'
```

The code a few lines
above (95-100) ([ref](https://github.com/0robustus1/rails_semantic_logger/blob/master/lib/rails_semantic_logger/engine.rb#L95-L100))
is already written defensively. This does the same for this
invocation of config.assets.
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.

1 participant