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!
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.
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?
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?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.