Subscribed unsubscribe Subscribe Subscribe

@kyanny's blog

Write down what I learnt. Opinions are my own.

Serve static html file with assets at both production and development

The best way to serve static html pages at Rails 3 is using asset pipeline. An article Precompile Static HTML Pages with Rails 3 Asset Pipeline describes how to do it.

By the way, asset pipeline is a mechanism for production environment, so the above solution is not fit for development environment.

I figured out a solution of this problem. I created StaticPagesController. The action of this controller renders static html pages by render with :file option.

Then you can see a rendered sample.html.erb page both at production and development. In production, you can access to this page via URL like In development (with pow), you can access to this page via URL like

I think I have to do more optimization for this solution, but it works well.