Looking forward to Rails 2.3
There are two things that i am especially looking forward to in Rails 2.3.
I use named_scope like all the time now since i figured out what they are and how useful they can be. I often find myself doing something like this:
named_scope :ordered, :order => 'surname ASC, first_name ASC'
Just so that i can append .ordered to any other named_scope and get my objects out in a sensible order. Well in Rails 2.3 we're going to have a default_scope
default_scope :order => 'surname ASC, first_name ASC'
Marvellous! :D
The other thing i'm looking forward to is the new super-slick render for partials. No more
render :partial => 'articles/article', :locals => { :article => @article }
render :partial => 'articles/article', :collection => @articles
Those now become the splendidly simple
render @article
render @articles
Thanks to Ryan's Scraps for explaining to me how that's going to work!
Related posts (automatically calculated)
December 10th, 2008 at 05:02
render :partial => 'articles/article', :locals => { :article => @article }
is 'correctly' written as:
render :partial => 'articles/article', :object => @article
in Rails 2.0 - 2.2
both can also be written as:
render :partial => @article(s)
but I think you probably already knew that.
December 10th, 2008 at 08:49
Oh that's cool! It's already simpler than i thought it was, then! :) Yay!
I must confess, i don't know all the clever tricks when it comes to partials. I haven't used them often enough to get properly familiar with them.