Forum: Ruby on Rails The reason for 'list'

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Richard <> (Guest)
on 2005-12-08 07:38

When ever I use scaffolding to start off and provide the basics for
writing to, and reading from, a database table I notice that in the
controller it always has:

def index
  render :action => 'list'

I understand what the index method does, and I understand what render
does.  What I don't understand is why has 'list' there before the render
method?  What is this call doing?

The reason I am asking is that when I take 'list' line out of the index
method, the list action will not work?  Why is this?

Thanks for any help,
Pat M. (Guest)
on 2005-12-08 08:11
(Received via mailing list)
Hi Richard,

When you call render, all it does it spit some output to the browser.
So in this particular case, it's simply displaying the output of the
list.rhtml file.  For that to work though, you need to perform the
logic in the view action, which in the case of list is to simply
create an array of objects.  The index method then is calling the list
action to perform the code there, and then uses the list.rhtml
template as output.


On 12/7/05, Richard <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.