#list in generated controllers


#1

Why does a controller created with "ruby script/generate controller
" always have an action called list with the following lines?

01 def index
02 list
03 render :action => ‘list’
04 end

I understand line 03 is there to define a default action, but what is
the purpose of line 02?


#2

On Mar 12, 2007, at 12:23 , David E. wrote:

Why does a controller created with "ruby script/generate controller
" always have an action called list with the following lines?

01 def index
02 list
03 render :action => ‘list’
04 end

I understand line 03 is there to define a default action, but what is
the purpose of line 02?

Line #2 calls the list action so the code in that is run, setting up
list variables etc.
Line #3 renders the view from the list action, so the index action
looks like the list action.


Jakob S. - http://mentalized.net