one of the most amazing frameworks for dynamic content.. and what's my problem? i cant figure out where the hell the best place is to place static content.
my first thought was "sure i could just dump a file in /app/views". seems like a reasonable solution.. but of course rails won't route that correctly.
so the next solution is to put it there or somewhere else and map it using /config/routes.rb
yeah that could work too..
i definitely wanted it to inherit the layout of all the other pages though and that was managed by the controllers.. so -
easiest thing to do though is to just dump it in a controller.. so for example my file was an faq so i dumped it in
/app/views/mycontroller/faq.rhtml
you dont have to create a placeholder or anything like that.. like
def faq
end
in your "mycontroller" controller.. just drop the file in and go to it in your browser
localhost:3000/mycontroller/faq
if you want it to appear outside the controller i guess the best bet is to just use routes.rb.




May 16th, 2007 at 22:54
Thanks for posting this. I was wondering what to do myself. Have your thoughts changed on this topic since you posted?
June 25th, 2007 at 12:42
This is how I do it:
http://darwinweb.net/article/Routing_Nested_Static_Content_In_Rails
I've recently upgraded it to support automatic references to index.rhtml on subfolders of content/
June 27th, 2007 at 15:08
I was searching for an answer to this on Google and happened across this article; funnies. The last hit I found suggested using method_missing so that you don't have to create a method for each static page.
http://lists.rubyonrails.org/pipermail/rails/2005-March/004449.html