Article

Rails 1.1 is Out

Check out DHH’s post describing all the changes. With so many fixes and cool new features, it’s kind of amazing this is just a minor release!

The difficult (and great!) thing about Rails is that every time a new release comes out I have the urge to completely rewrite all of my applications. Just browsing through some of the RJS examples, I can see how using these would have made developing Teacher! a lot easier and cleaner.

Something like this:

page[:average_grade].replace_html :partial => "student/average_grade"

would have been about ten times simpler than the pure Javascript I’m using right now.

Over at Scott Raymond’s blog there’s a more in-depth guide to what’s new, including this beauty:

%w(1 2 3 4 5 6 7).in_groups_of(3) {|g| p g}
["1", "2", "3"]
["4", "5", "6"]
["7", nil, nil]

How awesome is that? No more setting up a counter and checking wether it’s divisible by three on each loop. So I can just do something like:

@students.in_groups_of(3) { |group|
group.each{|student|
render :partial => 'student'
}
}

That’s cool.

One last thing I’m excited about: calculations. Where before I had to do a bunch of queries and insertions and array manipulations to get a student’s average grade for a group of assignments, now I can just do:

Assignments.average(:grade, :conditions => ["student_id = ?", @student.id])

I can’t tell you how much easier this makes my life. Seriously.

So, congrats to the Rails team for pushing out another release so soon after the big one-point-oh! And I’m sure there’s more to come…

Comments (No comments)

There are no comments for this post so far.

Post a comment