Project

General

Profile

Bug #13171

Plugins with /public/assets prevent Rails starting in development environment

Added by Dominic Cleal almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugins-Engines
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

When a plugin is registered that has a /public/assets directory in its root, Rails can't start up in the development environment. This happens because the assets initialiser tries to serve the public/ directory.

/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/actionpack-4.1.5/lib/action_dispatch/middleware/stack.rb:112:in `push': can't modify frozen Array (RuntimeError)
        from /home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/actionpack-4.1.5/lib/action_dispatch/middleware/stack.rb:112:in `use'
        from /home/dcleal/code/foreman/foreman/config/initializers/assets.rb:66:in `block (2 levels) in <top (required)>'
        from /home/dcleal/code/foreman/foreman/config/initializers/assets.rb:64:in `each'
        from /home/dcleal/code/foreman/foreman/config/initializers/assets.rb:64:in `block in <top (required)>'
        from /home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/railties-4.1.5/lib/rails/railtie.rb:210:in `instance_eval'
        from /home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/railties-4.1.5/lib/rails/railtie.rb:210:in `configure'
        from /home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/railties-4.1.5/lib/rails/railtie.rb:182:in `configure'
        from /home/dcleal/code/foreman/foreman/config/initializers/assets.rb:2:in `<top (required)>'

This can happen if you've used the plugin:assets:precompile rake task as used in packages.


Related issues

Related to Foreman - Refactor #12914: update rails configuration files to match to 4.1 syntaxClosed2015-12-22

Associated revisions

Revision 8fd3f74b (diff)
Added by Eric Helms almost 4 years ago

Fixes #13171: Prevent frozen array error when plugins have assets

When the application is configured to serve static assets, the
public/asset paths of the plugins need to be added to the middleware
stack. However, this needs to occur prior to the middleware stack
being built. This is attainable by moving it into the main application
configuration logic.

This also includes an update to the sprockets manifest name that
appears to have changed with sprockets version updates. This means
that plugin assets and their manifests were not being loaded in
production environments.

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Related to Refactor #12914: update rails configuration files to match to 4.1 syntax added

#2 Updated by Ohad Levy almost 4 years ago

the workaround is simply to delete the public/assets directory (as its generated via the assets precompile task).

#3 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Eric Helms
  • Pull request https://github.com/theforeman/foreman/pull/3103 added

#4 Updated by Eric Helms almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF