Forum: Ruby on Rails render :action => '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.
Gonzalo (Guest)
on 2006-03-22 00:24
does anybody know what the hell "render :action => 'list'" means???

is "render" a method? is :action a parameter?

thanks a lot.
Daniel -. (Guest)
on 2006-03-22 00:31
(Received via mailing list)
Hi Gonzalo

Render is a method of ActionController and ActionView.  The docs can be
for the controller version.

The :action =>'list' is a parameter hash to tell the method what to
The list action of the controller should be rendered in this case.

There are plenty of good docs available on the site to
you going.  The wiki is a good place to start

Wilson B. (Guest)
on 2006-03-22 00:34
(Received via mailing list)
render is a method (an instance method on ActionController).  :action
=> 'list' is a literal Hash with one entry. The key is :action (a
Symbol), and the value associated with that key is 'list' (a String).
That's equivalent to:
args =
args[:action] = 'list'

..but that's three times as long, and doesn't communicate the intent
as well.  Hashes are used frequently in Rails because they make method
calls easier to read, and Ruby doesn't have 'real' keyword arguments
like Smalltalk and various other languages.
ChrisT (Guest)
on 2006-03-22 00:36
(Received via mailing list)
A fellow newbie writes...

In the words of the API:
"  Renders the content that will be returned to the browser as the
response body... Action rendering is the most common form and the type
used automatically by Action Controller when nothing else is specified.
By default, actions are rendered within the current layout (if one

In this case it's rendering the method 'list' in the current controller.

for full details.

Hope this helps

Gonzalo (Guest)
on 2006-03-22 00:45
thanks a lot, again.
This topic is locked and can not be replied to.