Ruby, Rails, Firefox, Anime, Mac
This week’s report covers changes from 3 Mar 2008 to 9 Mar 2008 (the day the corresponding Rails Envy podcast was recorded).
This is another ActiveRecord performance boost related to the pre-loading any eager-loaded
:includes mentioned previously. Basically what this patch does is to only join referenced tables when needed. It does this by checking the
:limit options to determine whether a table should be joined or can be left out and pre-loaded instead. You can find out more in tickets #9560 and #9497.
Credit goes to Gabe da Silveira (dasil003 on Trac) for this awesome performance patch.
Related changeset: http://dev.rubyonrails.org/changeset/8977
Now when you pass an incorrectly formed request (e.g. GET, POST) parameter to your controller, it will raise an exception that includes a friendlier error message that indicates exactly what you passed to it. This is helpful when trying to debug whether you constructed your form correctly.
Contributors: Chad Humphries and matt.
Related changeset: http://dev.rubyonrails.org/changeset/8986
Here’s something I didn’t know: you can actually use
any in your
respond_to blocks as a catch-all response. E.g.
respond_to do |format| format.html do redirect_to :action => 'login' end format.any(:js, :xml) do request_http_basic_authentication 'Web Password' end end
Contrary to its name, using ‘any’ actually requires you to pass a list of types to respond to. This has been enhanced now so that if you don’t pass any arguments, it’ll function as a real catch-all.
respond_to do |format| format.any do request_http_basic_authentication 'Web Password' end end
Credit goes to Joshua Wehner for this patch.
Related changeset: http://dev.rubyonrails.org/changeset/8987
Turns out the
:readonly option for associations mentioned earlier was left out for
has_many :through associations. This oversight has been fixed.
Thanks to Emilio Tagua for this bugfix.
Related changeset: http://dev.rubyonrails.org/changeset/8989
As usual, let me know of any inaccuracies or any suggestions you may have in the comments!