The reason for 'list'

Hi,

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
list
render :action => ‘list’
end

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,
Richard

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.

Pat

On 12/7/05, Richard [email protected]