Mysterious Method added by Scaffold

I have created a blog by following the instructions detailed in the
now-famous blog screencast. Now, I’m attempting to increase my
knowledge of Rails by accomplishing that same feat in a more hands-on
way (i.e., without a scaffold). One perplexing issue that I have
encountered is that when I created the blog using a scaffold the
various template files that were created contained several instances
of mysterious code that looked similar to this:

<%= link_to ‘Back’, posts_path %>

and this:

<%= link_to ‘Edit’, edit_post_path(@post) %>

In the above, ‘posts_path’ and ‘edit_post_path’ appear to be methods;
but, I can’t find where these methods are defined. If I insert
similar code into the blog that I created without a scaffold, Rails
complains about a missing method. Can someone please explain what the
story is on the mysterious methods?

Thanks for any input.

      ... doug

Doug J. wrote:
[…]

In the above, ‘posts_path’ and ‘edit_post_path’ appear to be methods;
but, I can’t find where these methods are defined.
[…]

They are defined by your named routes. Read the routing docs and run
“rake routes” to see what you’ve got.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Try this for starters…

Rick

Thanks, Marmen. It’s going to take me a while to digest this.

     ... doug