views:

337

answers:

2

I am new to rails so go easy. I have developed my blog and deployed it successfully. The entire app is based out of the post_controller. I am wondering how I can reroute the users path to default to the post_controller vs. the app controller.

To illustrate, if you go to http://mylifebattlecry.heroku.com you will see the default rails page. If you go to http://mylifebattlecry.heroku.com/posts you will see the the app. Once I complete this I will change my domain of http://www.mylifebattlecry.com to map to Heroku but need to know how to get the /posts to be where the visitor is sent.

A: 

Add the following line to your confing/routes.rb:

map.root :controller => "posts"

You need to restart your server after that.

khelll
+8  A: 

You need to do two things

  1. Delete the file /public/index.html
  2. Update the file /config/routes.rb

    map.root :controller => "posts"

This will then call the index action in your posts controller. You will need to restart the application to see changes to routes.rb

MattMcKnight