Forum: Ruby on Rails #list in generated controllers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David E. (Guest)
on 2007-03-12 13:23
Why does a controller created with "ruby script/generate controller
<NAME>" 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?
Jakob S. (Guest)
on 2007-03-12 21:28
(Received via mailing list)
On Mar 12, 2007, at 12:23 , David E. wrote:

> Why does a controller created with "ruby script/generate controller
> <NAME>" 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
This topic is locked and can not be replied to.