# I'm a newb ... I'm not be able to add a new method to my controller

**URL:** <https://www.ruby-forum.com/t/im-a-newb-im-not-be-able-to-add-a-new-method-to-my-controller/144635>\
**Category:** Rails\
**Created:** [July 31, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/im-a-newb-im-not-be-able-to-add-a-new-method-to-my-controller/144635 "2008-07-31T17:42:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![divino\_marchese](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@divino\_marchese](https://www.ruby-forum.com/u/divino_marchese)\
**Post date:** [July 31, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/im-a-newb-im-not-be-able-to-add-a-new-method-to-my-controller/144635/1 "2008-07-31T17:42:26Z")

</div>

Hi, I’m a newb . I joined because I have a question. Here above there  
are my steps.

1. I add to my controller a method: view\_all
2. I type: [http://localhost:3000/entries/view\_all](http://localhost:3000/entries/view_all) in my browser.
3. I recive this error

ActiveRecord::RecordNotFound in EntriesController#show

Couldn’t find Entry with ID=view\_all

Perhaps I forgot something.

PS I followed a tutorial.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![divino\_marchese](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@divino\_marchese](https://www.ruby-forum.com/u/divino_marchese)\
**Post date:** [July 31, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/im-a-newb-im-not-be-able-to-add-a-new-method-to-my-controller/144635/2 "2008-07-31T17:55:36Z")

</div>

divino\_marchese wrote:

> Hi, I’m a newb . I joined because I have a question. Here above there  
> are my steps.
> 
> 1. I add to my controller a method: view\_all
> 2. I type: [http://localhost:3000/entries/view\_all](http://localhost:3000/entries/view_all) in my browser.
> 3. I recive this error
> 
> ActiveRecord::RecordNotFound in EntriesController#show
> 
> Couldn’t find Entry with ID=view\_all
> 
> Perhaps I forgot something.
> 
> PS I followed a tutorial.
> 
> Thanks a lot.

I’m guessing you are using map.resources to configure the routing for  
entries? Typically, the index action does the job of “view all”.

---

<div class="post-metadata">

**Author:** ![divino\_marchese](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@divino\_marchese](https://www.ruby-forum.com/u/divino_marchese)\
**Post date:** [July 31, 2008, 6:01pm UTC](https://www.ruby-forum.com/t/im-a-newb-im-not-be-able-to-add-a-new-method-to-my-controller/144635/3 "2008-07-31T18:01:49Z")

</div>

Welcome Divino!

Your problem is in routes.rb. You’ll need to add view\_all to your  
map.resources :entries

It should look like this:

map.resources :entries, :collection =\> { :view\_all =\> :get }

However, technically [http://localhost:3000/entries](http://localhost:3000/entries) should show all the  
entries. You seldom have to create custom actions.

Hope that helps!

~Dustin T.
