Skip to content

defined?(ActionDispatch::Static) is always true#35

Closed
Antronin wants to merge 1 commit intoericallam:masterfrom
Antronin:patch-1
Closed

defined?(ActionDispatch::Static) is always true#35
Antronin wants to merge 1 commit intoericallam:masterfrom
Antronin:patch-1

Conversation

@Antronin
Copy link

Instead check if we are serving static files, as that will explicitly means ActionDispatch::Static is loaded.

Instead check if we are serving static files, as that will explicitly means ActionDispatch::Static is loaded.
@switzersc
Copy link

Also, in Rails 4.1.6, checking for ActionDispatch errors out:

No such middleware to insert before: "ActionDispatch::Static"
/home/rof/cache/bundler/ruby/2.2.0/gems/actionpack-4.1.6/lib/action_dispatch/middleware/stack.rb:125:in `assert_index'
/home/rof/cache/bundler/ruby/2.2.0/gems/actionpack-4.1.6/lib/action_dispatch/middleware/stack.rb:88:in `insert'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/configuration.rb:68:in `block in merge_into'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/configuration.rb:67:in `each'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/configuration.rb:67:in `merge_into'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/engine.rb:497:in `app'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/application/finisher.rb:36:in `block in <module:Finisher>'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
/home/rof/cache/bundler/ruby/2.2.0/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'

But 'serve_static_files' raises a no method error.

@mzsanford
Copy link

I solved this a different way in #53, by inspecting the middleware list

@Antronin Antronin closed this May 2, 2018
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.

3 participants