Static pages from Rails erb templates?

Is there a way to have static content generated from Rails templates without going through the empty controller nonesense? Sometimes a site, especially an old one, has lost of static content and a few forms where only the forms need to be handled by Rails but it is necessary for Rails to use the same templates as required by the static content.

gvim

Maybe high voltage gem will work for you.

https://github.com/thoughtbot/high_voltage

At first glance this looks way over-complicated for what I had in mind. I would like to have the option to run some kind of rake task which can identify erb templates for static generation and publish them to the public directory. I could simply use Middleman but then I have to keep my templates and assets in sync with my Rails templates so not ideal.

gvim

It's not complicated. Install the gem. Create a directory. Use page_path route with the file name to generate links. I'm not sure how you get simpler than that.

If you want a non rails way, put the pages in the public directory.

Seems like you could have been finished with either high voltage or public in the time it took you to publish another comment.

Can one use erb in the public directory?

Colin

Please ignore the snarky comment at the end of the last comment and the stuff about just or putting in the public directory. I re-read your comment on Middleman and got a better feeling for what you are trying to do.

The snark was me being out of my mind.

Back on topic how dynamic is the erb you have? Are there models to go through? Are the links hard coded or generated from link_to statements? Maybe some sample pages would be helpful to offer suggestions.

I don't think you can use erb in public. I don't think they'd be parsed to html outside of the app area.

That's what I thought.

Colin

It's just basic headers and footers really with <title> dynamic. I'm moving a Perl CGI::Application app to Rails. Most of the files are static and were generated with Perl Template::Toolkit. The company is looking to do bigger things so I thought I'd port everything to Rails in preparation. Rails will just handle the forms for now. Didn't like the way Middleman seems to require a duplicate copy of all the assets.

gvim