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!
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.
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.
Thans for example,
No worries! I hope you saw Aleksey's comments that it is already much simpler than i imagined. Partials are TEH AWSUM!
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.
Thanks to this blog.. this make it simple… and there is a sample.. Thank you to you..
Thanks to this blog.. this make it simple… and there is a sample.. Thank you to you..
Rails 2.3 is really awesome, it is much better than rails 2.0, thanks for sharing those codes I'm having a hard time with them never thought they were just so simple
Rails 2.3 is really awesome, it is much better than rails 2.0, thanks for sharing those codes I'm having a hard time with them never thought they were just so simple