Yeah, so I'm sure everyone who cares already knows that Ruby on Rails 1.1 has been released. Congratulations to the core team for what appears to be a quality release. They are building on their strengths for sure and offering some compelling new features.
The official announcement is available, and the semi-official overview of what's new in Rails 1.1 was posted by Scott Raymond.
My Favorite Ruby 1.1 Features
with_scope
You can now set up blocks to easily filter the selection of your model objects. This with_scope feature uses blocks, so you can easily store these blocks as variables and share them among multiple Model objects or methods.
Eager Loading
Lazy loading is often a big performance benefit for rarely used objects, but in cases when you know you are going to need the children of an object, ORM tools can optimize queries by doing Eager Loading in appropriate cases. Eager Loading can be done by doing outer joins and getting all of the children in the same query as the parent (or at the very least getting the collection in a single SELECT statement).Menu.find(:all, :include => {:categories=>:menuItems})
Polymorphic Database Associations
A complicated name for the fairly simple concept of allowing more than one table to be associated with a child table.
The only problem with this implementation is that this is implemented in
such a way that you can't do foreign key contraints. Basically the tag
table will have a taggable_id
which corresponds to the
parent table's id and a taggable_type
which corresponds to the class of the parent.
What I'm Curious About (and might be real cool)
RJS
RJS is described as "JavaScript written in Ruby". Basically there is a new kind of template in addition to .rhtml and .rxml you can now create .rjs files. These are used as the response to AJAX calls and render JavaScript. This JavaScript is used to change an already rendered page from an AJAX callback.I'm keeping my eye on this one cause I think it could be interesting.