Skip to content

Rails.application.assets is nil in production #237

Closed
@kirs

Description

@kirs

Now in sprockets-rails 3 app.assets is set only in case when assets.compile option is enabled (https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L142).

By default in Rails this option is set to false in production environment: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt#L27

This leads us to the bug when some gem calls Rails.application.assets.resolve("asset.js") in production environment and the NoMethodError is raised.

@josh does it sounds like a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions