# Set up a default route

**URL:** <https://www.ruby-forum.com/t/set-up-a-default-route/65044>\
**Category:** Rails\
**Created:** [August 15, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044 "2006-08-15T20:36:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/1 "2006-08-15T20:36:26Z")

</div>

Phlip wrote:

> Can I fix it by adding a view called ‘inventories’?

That worked, because I have a sufficiently late version of MySQL.

Next question. What does “Set up a default route” mean?

When I read…

```
http://wiki.rubyonrails.com/rails/pages/Routes

```

…it reminds me of the Apache documentation for mod\_rewrite. I hope  
someone appreciates the candor of my naivete’ and works on the  
“simplest path” through this stuff.

I add…

map.connect ‘inventories’, :view =\> ‘inventories’, :controller =\>  
‘inventory’

to config/routes.rb, and hit [http://localhost:8000/inventories](http://localhost:8000/inventories) , and  
get a missing page message.

What’s the simplest configuration to hit a view?

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 9:21pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/2 "2006-08-15T21:21:38Z")

</div>

On Aug 15, 2006, at 2:33 PM, Phlip wrote:

> [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/Routes)  
> to config/routes.rb, and hit [http://localhost:8000/inventories](http://localhost:8000/inventories) , and  
> get a missing page message.
> 
> What’s the simplest configuration to hit a view?

Generally you hit an action, not a view. The action determines what  
view to load (defaults to the view with the same name)

try:  
map.connect ‘inventories’, :controller =\> ‘inventory’, :action =\>  
‘inventories’

You’ll need an ‘inventory’ controller that has an ‘inventories’ method.

But you can also access that with:

localhost:8000/inventory/inventories

Assuming you didn’t change the routes file too much.

Anyway, the default route usually refers to : map.connect ‘’ …

So that way browsing to [http://localhost](http://localhost):port/ yields part of your  
app, rather than public/index.html

-Mat

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 9:27pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/3 "2006-08-15T21:27:39Z")

</div>

Mat S. wrote:

> You’ll need an ‘inventory’ controller that has an ‘inventories’ method.

Thanks - I’l try those and reply.

The general topic here is the “getting started” documentation worked  
fine for installing Rails - even a newbie could do it (except on  
Ubuntu).

Then the documentation sort of cliffed-over and dropped flat. The  
effect was kind of like following a trail of breadcrumbs through the  
forest and discovering they stop suddenly.

(Wilderness tip: Don’t drop breadcrumbs. Break off twigs in the  
direction you are going…)

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 9:45pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/4 "2006-08-15T21:45:41Z")

</div>

Mat S. wrote:

> You’ll need an ‘inventory’ controller that has an ‘inventories’ method.

Back to the generator. What’s wrong with this?

ruby script/generate ajax\_scaffold Inventory

> localhost:8000/inventory/inventories

That’s a page-not-found right now, with “File does not exist:  
C:/phlip/projects/rails/public/inventory” in the log.

> What are you reading?

The “Welcome aboard” default page.

Couldn’t it ass-ume MySQL, and then step you just as far as a Hello  
World situation?

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 10:00pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/5 "2006-08-15T22:00:43Z")

</div>

Phlip wrote:

> That’s a page-not-found right now, with “File does not exist:  
> C:/phlip/projects/rails/public/inventory” in the log.
> 
> > What are you reading?
> 
> The “Welcome aboard” default page.
> 
> Couldn’t it ass-ume MySQL, and then step you just as far as a Hello  
> World situation?

If this is your first trip in the world of Rails, may I recommend that  
you try a brief tutorial (such as the ‘Four Days with Rails’) which will  
give you a trip round the amusement park and introduce you to the  
attractions. There is a lot of ‘magic’ that goes with Rails, but it  
does help to get your concepts almost right. You definitely come across  
a person who has the knowledge, but just needs the orientation 😃

As such, ajax\_scaffold is not part of standard Rails (as I know it) and  
that may be throwing up some issues for you. Try the basic stuff first  
and it should all work.

Cheers  
Mohit.

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [August 15, 2006, 9:36pm UTC](https://www.ruby-forum.com/t/set-up-a-default-route/65044/6 "2006-08-15T21:36:40Z")

</div>

On Aug 15, 2006, at 3:25 PM, Phlip wrote:

> Mat S. wrote:
> 
> > You’ll need an ‘inventory’ controller that has an ‘inventories’  
> > method.
> 
> Thanks - I’l try those and reply.
> 
> The general topic here is the “getting started” documentation worked  
> fine for installing Rails - even a newbie could do it (except on  
> Ubuntu).

Well, so long as the command 'rails MyApp works, it should become  
pretty much the same on any platform. You might want to pick up  
another trail of crumbs… er… twigs.

What are you reading? Perhaps it’s a wiki page that could use some  
attention.  
-Mat
