Search code examples
ruby-on-railsruby-on-rails-3webrick

Rails won't serve static content on Webrick in development mode


I have been trying almost everything to get rails/webrick to serve an html file in development mode, however I keep getting the following error:

No route matches [GET] "/public/index.html"

Even after setting config.assets.enabled = true nothing changes. Running Rails 3.2.2


Solution

  • The public directory is your root directory from the website perspective. For instance:

    /path_to_rails/public/index.html = http://localhost:3000/index.html
    /path_to_rails/public/subdir/home.html = http://localhost:3000/subdir/home.html
    

    This assumes you are running your local dev server at http://localhost:3000