03 Sep 2009

Easy partials

Following code has been tested with Rails 2.3 .

Traditional way of rendering partials.

render :partial => 'comments/comment', :locals => { :comment => comment, :show_article_title => false}

Above code can also be written as

render 'comments/comment', :comment => comment, :show_article_title => false

One more example.

render :partial => 'comment', :locals => { :comment => comment, :show_article_title => true }
render 'comment', :comment => comment, :show_article_title => true

I continue to see everyone use the version with keyword ‘partial’.

This change captures a bit of what I am talking about.