原文地址:Static site using rails.

As we know rails is mainly used for dynamic website.we can also display static web pages or we can deploy full static website using rails. The following code can help us to display static pages.

class StaticPage
Formats = {
"html" => "text/html",
"png" => "image/png",
"jpg" => "image/jpg"
}
end
def page
send_file
"#{Rails.root}/app/views/static_pages/#{params[:filename]}.#{params[:format]}",:disposition =>'inline',:type => StaticPage::Formats[params[:format]]
end

Step 7 :- Start server and Type url as shown below.

ruby script/server