What's the best way to serve static HTML documents in Rails with a layout? Obviously I could just keep the HTML files in the public/
directory, but then I wouldn't be able to apply a layout, or could I? Otherwise I could put the following in config/routes.rb
:
match ':page' => 'static#display', :page => /.+\.html/
Does .+\.html
work so it ends with .html
? Anyway, assuming it did, I guess I'd have a controller:
class StaticController < ApplicationController
layout 'static_files'
def display
render params[:page]
end
end
Assuming that works properly, will Ruby unnecessarily try and parse the HTML file as an ERB file? Is there a better mechanism Rails has for this?
.html
files throughERB
if the files have the.html.erb
extension.