views:

633

answers:

3

I've created some resources in my Ruby on Rails application:

localhost/admin/books
localhost/admin/users
localhost/admin/...

Now I want to create a static page which just contains links to these resources and is accessible from localhost/admin

I've tried to create the page in /public/admin/index.html and it works, but unfortunately I have to duplicate the layout of my resource controllers in that file.

Is there any other way to create a static page?

EDIT: With "static page" I don't mean a static page in that sense that the source of that page is static. I mean that the content is static, i.e. is not generated by a model and/or from database.

+1  A: 

Just create a view with the contents you'd have for the page, call it "index.html.erb", and leave the action method in the controller as a no-op.

Use page caching for bonus points.

Jim Puls
+1  A: 

Ryan Bates has a screencast on this topic.

Darin Dimitrov
+1  A: 

What about: "Use Rails to Create a Static Site" from the usefulfor.com/ruby guys?