Frew Schmidt
Frew Schmidt

Reputation: 9544

How do I change the index page for rails?

I know that to change the index page for rails I need to do three things: delete the index.html, do something with routes.rb, and probably make an action that the route will point to. It's the details that I am a little fuzzy on :-)

Upvotes: 4

Views: 10205

Answers (4)

Georg Keferböck
Georg Keferböck

Reputation: 1977

Please note from RoR Version 4.0 + this changed - follow the simple steps on the getting started guide !

It will become clear within minutes how it works.

Just thought it might be worth updating this threat, as those using a newer version might get confused and frustrated :)

Upvotes: 1

allesklar
allesklar

Reputation: 9580

Follow Frew's steps and, as step 4, put a little html code in the index view file in the /views/foo folder to test it all.

Example:

<h1>My New Index Page</h1>
<p>Some text here.</p>

Upvotes: 5

user7366
user7366

Reputation: 191

Don't forget to restart your server.

You can also run rake routes to show all the known routes and make sure everything looks sane.

Upvotes: 3

Frew Schmidt
Frew Schmidt

Reputation: 9544

Ok, I figured it out. Basically you

  1. Delete public.html
  2. Add 'map.root :controller => "foo"' to routes.rb
  3. and then of course create the controller foo with the action index.

Upvotes: 13

Related Questions