Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Index Page - Ruby on Rails

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.

like image 928
bgadoci Avatar asked Nov 24 '09 04:11

bgadoci


1 Answers

You need to do two things

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

map.root :controller => "posts" #RAILS 2

or

root :to => 'posts#index' #RAILS 3

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

like image 119
MattMcKnight Avatar answered Oct 26 '22 16:10

MattMcKnight