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

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

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 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".

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 should show all the entries. You seldom have to create custom actions.

Hope that helps!

~Dustin Tigner