divino_marchese
2008-Jul-31 15:20 UTC
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Weiskotten
2008-Jul-31 15:55 UTC
Re: I''m a newb ... I''m not be able to add a new method to my controller
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". -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dustin Tigner
2008-Jul-31 16:01 UTC
Re: I''m a newb ... I''m not be able to add a new method to my controller
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 On Jul 31, 9:20 am, divino_marchese <divino.march...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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_allin 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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---