# Help from rubyonrails 2.1

**URL:** <https://www.ruby-forum.com/t/help-from-rubyonrails-2-1/146382>\
**Category:** Rails\
**Created:** [August 20, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/help-from-rubyonrails-2-1/146382 "2008-08-20T14:15:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@rustam](https://www.ruby-forum.com/u/rustam)\
**Post date:** [August 20, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/help-from-rubyonrails-2-1/146382/1 "2008-08-20T14:15:51Z")

</div>

hi every one !  
receintly i am working on rails 2.1,i have start it from scaffold  
,besides from the pages which is created by scaffold automatically ,i  
have created the page “ingrendient.html.erb” and i have added the method  
ingredient  
def ingredient

end  
but i have faced the error massage when i tried to open the page  
ingredient.html.erb  
error massage is  
“Couldn’t find Drug with ID=ingredient”  
can anyone help me .please

---

<div class="post-metadata">

**Author:** ![rustam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@rustam](https://www.ruby-forum.com/u/rustam)\
**Post date:** [August 20, 2008, 2:55pm UTC](https://www.ruby-forum.com/t/help-from-rubyonrails-2-1/146382/2 "2008-08-20T14:55:28Z")

</div>

On Wed, Aug 20, 2008 at 8:15 AM, Rustam M. \<  
removed\_email\_address@domain.invalid\> wrote:

> ingredient.html.erb  
> error massage is  
> “Couldn’t find Drug with ID=ingredient”  
> can anyone help me .please

The scaffold in Rails 2.1 uses what is called Resources (  
[http://api.rubyonrails.org/classes/ActionController/Resources.html](http://api.rubyonrails.org/classes/ActionController/Resources.html)). In  
your config/routes.rb, you should see a line like:

map.resources :recipes

To add a custom method outside the standard 7 (index, show, new, create,  
edit, update, destroy), you need to tell resources about it. There are  
2  
different types of methods on a resource: collection and member. If the  
action acts on multiple models, it’s a collection, if it acts on a  
single  
model (requires params[:id]), then it is a member.

```
map.resources :recipes, :collection => {:ingredients => :get}

```

Hope that helps,  
Brandon

## –

Sessions by Collective Idea: Ruby on Rails training in a vacation  
setting  
[http://sessions.collectiveidea.com](http://sessions.collectiveidea.com)

---

<div class="post-metadata">

**Author:** ![rustam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@rustam](https://www.ruby-forum.com/u/rustam)\
**Post date:** [August 20, 2008, 3:20pm UTC](https://www.ruby-forum.com/t/help-from-rubyonrails-2-1/146382/3 "2008-08-20T15:20:29Z")

</div>

thanks Brandon it helped me out!
