# The main index.html

**URL:** <https://www.ruby-forum.com/t/the-main-index-html/169955>\
**Category:** Rails\
**Created:** [June 10, 2009, 5:35pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955 "2009-06-10T17:35:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 5:35pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/1 "2009-06-10T17:35:51Z")

</div>

So if I want to grab info from various Models and put it on the main  
Index page how does that work? Since there’s no main index view or  
controller?.. or is there?..

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 5:42pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/2 "2009-06-10T17:42:45Z")

</div>

removed\_email\_address@domain.invalid wrote:

> So if I want to grab info from various Models and put it on the main  
> Index page how does that work? Since there’s no main index view or  
> controller?.. or is there?..

There can be. You can map the root path to anything you want – check  
the routing docs.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 7:10pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/3 "2009-06-10T19:10:58Z")

</div>

Anyone know off hand what that would be to connect a controller and  
view to the main index.html?

been looking around, seems this should do it?

map.connect “/”, :controller =\> ‘the5one’, :action =\> “index”

Tried a few combinations of that… can’t get it going… I’ll fiddle  
around a bit more…

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 7:53pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/4 "2009-06-10T19:53:12Z")

</div>

removed\_email\_address@domain.invalid wrote:

> So if I want to grab info from various Models and put it on the main  
> Index page how does that work? Since there’s no main index view or  
> controller?.. or is there?..

Rails’s default index.html file tells you what to do there.

–  
Phlip

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 11:55pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/5 "2009-06-10T23:55:31Z")

</div>

Not to beat a dead horse, but your routes.rb file is pretty clear on  
this.

…

# You can have the root of your site routed with map.root – just

remember to delete public/index.html.

# map.root :controller =\> “welcome”

…

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 7:15pm UTC](https://www.ruby-forum.com/t/the-main-index-html/169955/6 "2009-06-10T19:15:39Z")

</div>

Got it!

Either of these work:

map.connect “”, :controller =\> ‘mycontroller’, :action =\> “index”

map.root :controller =\> “mycontroller”

I just had to delete the index.html in the public directory.
