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!

About these ads

9 comments on “Looking forward to Rails 2.3

  1. 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.

  2. 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.

  3. No worries! I hope you saw Aleksey's comments that it is already much simpler than i imagined. Partials are TEH AWSUM!

  4. Partials are one of the things that regularly frustrate me in Rails since I use them a lot in a many different cases. But at the same time, they probably are one of my favorite Rails features. Well, I guess I just find out the answer to every partials problem one by one as I go along.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s