historias para no dormir…
He aquí una receta enviada por Manuel a la lista de Rails en castellano y que no quiero que caiga en el olvido :)
How do folks use Rails to serve static, non-active record-backed content?
app/controller/pages_controller.rb
class PagesController < ApplicationControllerprivate
def method_missing(action)
render :action => action.to_s
endend
Then in app/views/pages just add files like foo.rhtml, bar.rhtml, etc. The url for them would be http://mydomain.dom/pages/foo and http://mydomain.dom/pages/bar. The plus is that you can put ERB in them for some simple generated content.
Of course, any files you put in public will be served up as static pages.
Tan ingeniosa como elegante.
Blog personal de Fernando Blat, sobre tecnologías web, y programación, ¿o era al revés?
No hay comentarios
Deja tu Comentario