class ActionDispatch::Static
Only files in the root directory are served; path traversal is denied.
are handed off to the main app.
Only GET and HEAD requests are served. POST and other HTTP methods
the public/
directory.
In Rails apps, this middleware is configured to serve assets from
If no file is found, it hands off to the main app.
This middleware serves static files from disk, if available.
= Action Dispatch Static
def call(env)
def call(env) @file_handler.attempt(env) || @app.call(env) end
def initialize(app, path, index: "index", headers: {})
def initialize(app, path, index: "index", headers: {}) @app = app @file_handler = FileHandler.new(path, index: index, headers: headers) end