# Question on the latest rails book

**URL:** <https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401>\
**Category:** Rails\
**Created:** [August 8, 2009, 1:31am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401 "2009-08-08T01:31:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 1:31am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/1 "2009-08-08T01:31:00Z")

</div>

Hi all,

I am learning rails by going through 3rd ed of the Rails book.  
In page 153, after creating the user scaffold it says:  
“Since this modified config/routes.rb, which is cached for performance  
reasons, you will need to start the server.”

This is confusing me, what changed config/routes.rb? The creation of the  
scaffold?  
But this is confusion because we have created several scaffolds before  
for orders, line\_items, etc and this was never told to us before. Why  
now?

Cheers,

Paulo M.

---

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 2:27am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/2 "2009-08-08T02:27:12Z")

</div>

Paulo J. Matos wrote:

> I am learning rails by going through 3rd ed of the Rails book.  
> In page 153, after creating the user scaffold it says:  
> “Since this modified config/routes.rb, which is cached for performance  
> reasons, you will need to start the server.”
> 
> This is confusing me, what changed config/routes.rb? The creation of the  
> scaffold?  
> But this is confusion because we have created several scaffolds before  
> for orders, line\_items, etc and this was never told to us before. Why  
> now?

These are two disjoint topics.

Firstly, a “scaffold generator” typically edits a few files. Use your  
version controller to see what it did to routes.rb. (And if you don’t  
have a  
version controller, such as git or svn, install it _now_!)

Secondly, when you change a Model, Controller, or View, Rails knows to  
reload the source when you go to the browser and refresh (usually F5).  
However, Rails naturally can’t extend this benefit to _all_ source.  
Otherwise it could end up reloading all of Ruby’s standard library and  
everything! So routes.rb is one of the files you must bounce the server  
if  
you edit.

Next, despite scaffolds will take you a long way, you must soon stop  
using  
them, and start writing features directly. Learn that, with unit tests,  
and  
you will be reading to roll with Rails!

–  
Phlip

---

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 8:47am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/3 "2009-08-08T08:47:21Z")

</div>

Phlip wrote:  
[…]

> So routes.rb is one of the files you must bounce the server  
> if  
> you edit.

Unless you’re using Rails 2.3, which (in dev mode) immediately  
incorporates changes in the routes file.

## Best,

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

---

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 10:09am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/4 "2009-08-08T10:09:42Z")

</div>

2009/8/8 Phlip [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > But this is confusion because we have created several scaffolds before  
> > for orders, line\_items, etc and this was never told to us before. Why  
> > now?
> 
> These are two disjoint topics.
> 
> Firstly, a “scaffold generator” typically edits a few files. Use your  
> version controller to see what it did to routes.rb. (And if you don’t have a  
> version controller, such as git or svn, install it _now_!)

Definitely agree with this. I would suggest git, which has a bit of a  
learning curve but will be time well spent.

> Secondly, when you change a Model, Controller, or View, Rails knows to  
> reload the source when you go to the browser and refresh (usually F5).  
> However, Rails naturally can’t extend this benefit to _all_ source.  
> Otherwise it could end up reloading all of Ruby’s standard library and  
> everything! So routes.rb is one of the files you must bounce the server if  
> you edit.

This does not answer the OP’s question as to why he got this message  
this time but not previously. Is it possible that the server was  
running this time so the message was produced, otherwise it is not  
produced (though I am not sure the scaffold generator would know  
that). Paulo, I wouldn’t worry about it if I were you, just restart  
if necessary and carry on.

> Next, despite scaffolds will take you a long way, you must soon stop using  
> them, and start writing features directly. Learn that, with unit tests, and  
> you will be reading to roll with Rails!
> 
> –

I disagree with that, keep using the scaffold generator to add new  
stuff, it is by far the easiest way of generating the files generally  
needed. Then use this as the base on which to build your application  
specific stuff. There may come a point at which it is easier to add  
new stuff entirely by hand but I certainly have not got there yet.  
Don’t forget to commit your source to your version control system  
after running the generator so you can look back and see what you  
changed.

Colin

---

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 10:40am UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/5 "2009-08-08T10:40:53Z")

</div>

For what it’s worth I am witrh Colin on this but this is covered in the  
foot note on page 46 of the pdf

1. If instead you see a message to the effect of No route matches  
“/say/hello”, try stopping and  
restarting your server, because something you have done caused Rails to  
cache your configuration  
information before the controller was created.

The point made on the page you are talking about (p159 on the pdf) I  
guess is a hang over from previous vewrsions of the book that dealt with  
old versions of rails but it’s a good lesson to learn. Always restart  
your server if you get unexpected results and after making a lot of  
changes. It takes no time to do and can save a lot of heartache trying  
to debug code that has no bugs!

---

<div class="post-metadata">

**Author:** ![Paulo\_JSMatos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/90ced4/32.png) [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Post date:** [August 8, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401/6 "2009-08-08T16:18:04Z")

</div>

Colin L. wrote:  
[…]

> I disagree with that, keep using the scaffold generator to add new  
> stuff, it is by far the easiest way of generating the files generally  
> needed. Then use this as the base on which to build your application  
> specific stuff.

Generally not, unless you happen to be creating apps which are very  
close to the scaffold.

> There may come a point at which it is easier to add  
> new stuff entirely by hand but I certainly have not got there yet.

Then either your applications are very unusual (or mine are, in the  
other direction) or you’re relying too much on a crutch. I agree  
totally that the scaffold generator should not be relied on.

> Don’t forget to commit your source to your version control system  
> after running the generator so you can look back and see what you  
> changed.

Yes!

> Colin

## Best,

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