# Mysterious Method added by Scaffold

**URL:** <https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079>\
**Category:** Rails\
**Created:** [June 12, 2009, 2:50am UTC](https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079 "2009-06-12T02:50:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [June 12, 2009, 2:50am UTC](https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079/1 "2009-06-12T02:50:02Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [June 12, 2009, 3:08am UTC](https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079/2 "2009-06-12T03:08:16Z")

</div>

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](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [June 12, 2009, 3:39am UTC](https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079/3 "2009-06-12T03:39:50Z")

</div>

Try this for starters…

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://guides.rubyonrails.org/routing.html)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

Rick

---

<div class="post-metadata">

**Author:** ![djames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7ab992/32.png) [@djames](https://www.ruby-forum.com/u/djames)\
**Post date:** [June 13, 2009, 3:47am UTC](https://www.ruby-forum.com/t/mysterious-method-added-by-scaffold/170079/4 "2009-06-13T03:47:43Z")

</div>

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

```
     ... doug
```
