does anybody know what the hell "render :action => ''list''" means??? is "render" a method? is :action a parameter? thanks a lot. -- Posted via http://www.ruby-forum.com/.
Hi Gonzalo Render is a method of ActionController and ActionView. The docs can be found http://api.rubyonrails.org/classes/ActionController/Base.html#M000178 for the controller version. The :action =>''list'' is a parameter hash to tell the method what to render. The list action of the controller should be rendered in this case. There are plenty of good docs available on the rubyonrails.org site to get you going. The wiki is a good place to start Cheers On 3/22/06, Gonzalo <gonzalo@soloproyectos.com> wrote:> > does anybody know what the hell "render :action => ''list''" means??? > > is "render" a method? is :action a parameter? > > thanks a lot. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060321/5b7f84a2/attachment.html
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 = Hash.new args[:action] = ''list'' render(args) ..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. On 3/21/06, Gonzalo <gonzalo@soloproyectos.com> wrote:> does anybody know what the hell "render :action => ''list''" means??? > > is "render" a method? is :action a parameter? > > thanks a lot. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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 exists)." In this case it''s rendering the method ''list'' in the current controller. See: http://api.rubyonrails.com/classes/ActionController/Base.html#M000178 for full details. Hope this helps CT Gonzalo wrote:> does anybody know what the hell "render :action => ''list''" means??? > > is "render" a method? is :action a parameter? > > thanks a lot. > >