Hi, I''m new to Rails (just a Java Programmer tired of having to configure a lot of xml''s and mapping classes just to make a simple page (...)) anyway, I''m experiencing some problems with routers, i''ve created a new project using Rails 2.0 and created a scaffold for users. so i have the following: users/new.html.erb ... (and the other pages created by the scaffold thing) now, i want to create a new action list.html.erb i''m with that default router that when I type /users/1 search for the user with id = 1 how do i call the list.html.erb page? because, when i type /users/list i get an error because it''s trying to search for an id = list (?) what would be the correct way to map this on routers.rb ? i have some doubts about the users_path, users_url, when scaffold generates the page he calls new_user_path for example. I didn''t understand how that is possible. If i creat that list.html.erb page on the users folder, will i be able to call an list_user_path ? Sorry if my questions look a little too beginner, maybe i missundertood something, and if someone can lead me to the right way, I''ll be very grateful! Thanks, Andre. -- 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 -~----------~----~----~----~------~----~------~--~---
The "users_path" and "users_url" methods map to the index action. Just add an "index" action to your controller and create a "index.html.erb" view file. Aaron --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aaron wrote:> The "users_path" and "users_url" methods map to the index action. > Just add an "index" action to your controller and create a > "index.html.erb" view file. > > AaronOk, but what if i want to create a list action instead of a index action? i have to create a "list" action on the controller, and create a "list.html.erb" just the same way? and about the new_user_path, that scaffold uses, i can call list_user_path? -- 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 -~----------~----~----~----~------~----~------~--~---
map.resources :users, :collection => { :list => :get } And then you should be able to go to /users/list For some reason it won''t make list_users_path work (WHY NOT????!). -Ryan On Jan 17, 11:03 am, Andreh Luis <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Aaron wrote: > > The "users_path" and "users_url" methods map to the index action. > > Just add an "index" action to your controller and create a > > "index.html.erb" view file. > > > Aaron > > Ok, but what if i want to create a list action instead of a index > action? > i have to create a "list" action on the controller, and create a > "list.html.erb" just the same way? > > and about the new_user_path, that scaffold uses, i can call > list_user_path? > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
kopf1988 wrote:> map.resources :users, :collection => { :list => :get } > > And then you should be able to go to > > /users/list > > For some reason it won''t make list_users_path work (WHY NOT????!). > > -Ryan > > On Jan 17, 11:03�am, Andreh Luis <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Thanks for the reply! now i just in doubt with the users_path! so the "something"_users_path is directly related to the routers? how does the new_user_path and other _users_path generated by scaffold work? i mean, how can i make anothe XXX_users_path? is it on the routers.rb? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---