Can rails handle creating a view without a controller? For example, let say I have a page that just links to other pages, would I need to create a dummy controller for that, or could I just do something in my routes file?
+3
A:
No. All requests has to go through a controller.
I like to have a PagesController
, with map.page ":action", :controller => "pages"
. That way, I can create app/views/pages/foo.erb
and have it available on /foo
without any extra code.
August Lilleaas
2009-08-29 21:28:13
Thoughtbot have a useful plugin for this: http://github.com/thoughtbot/high_voltage/tree/master
jonnii
2009-08-30 05:19:01
+1
A:
Another option would be adding a static html file in your /public directory if you truly don't need it as part of your application.
Andy Gaskell
2009-08-29 22:34:18
+1
A:
If you are a brave soul. You can try edge rails 3. Katz demonstrated this possibility on his blog. Here is the link:
http://yehudakatz.com/2009/07/19/rails-3-the-great-decoupling/
Aaron Qian
2009-08-30 16:31:46