Rails 2.3.3: Touching, faster JSON, bug fixes
Posted by David July 20, 2009 @ 05:28 PM
We’ve released Ruby on Rails version 2.3.3. This release fixes a lot of bugs and introduces a handful of new features.
Active Record
touchis a convenient method to update a record’s timestamp and nothing else. This is extracted from apps whose models “touch” others when they change, such as a comment updating the parent.replies_changed_at timestamp after save and destroy. Timestamping an entire has_many association makes it easy to build a key for fragment caching that covers changes to the parent object and any of its children. This pattern is wrapped up asbelongs_to :parent, :touch => :replies_changed_at. When the child changes,parent.replies_changed_atis touched.:touch => trueis defaults to:touch => :updated_at.:primary_keyoption forbelongs_tofor broader support of legacy schemas and those using a separate UUID primary key:belongs_to :employee, :primary_key => 'SSN', :foreign_key => 'EMPID'changeset
JSON
- decoding backends for the json and yajl libraries. Both are significantly faster than the default YAML backend. To get started, install the json gem and set
ActiveSupport::JSON.backend = 'JSONGem'. - leaner user-facing encoding API. Since a JSON libraries implement
to_jsonwith varying compatibility, safely overriding it is difficult. Most customto_jsonlooks like
so we DRYed the user-facing API down to a more naturaldef to_json(*encoder_specific_args) { :some => "json representation" }.to_json(*encoder_specific_args) end
without the ugly internal state exposed by overloadingdef as_json(options = {}) { :some => "json representation" } endto_jsonas both public-facing and internal builder API. Rails 3 splits the API explicitly, so prepare now by switching fromto_jsontoas_json.
Other Features
- Add :concat option to asset tag helpers to force concatenation. changeset
- Restore backwards compatibility for AR::Base#to_xml. changeset
- Move from BlueCloth to Markdown for the markdown helper. Users using BlueCloth to provide their markdown functionality should upgrade to version 1.0.1 or 2.0.5 in order to restore compatibility.
Notable Bug Fixes
- Fix errors caused by class-reloading with streaming responses in development mode.
- Several fixes to the gem bundling, unpacking and installing system.
- Make text_area_tag escape contents by default.
- Make filter_parameters work correctly with array parameters.
- Thread-safety fixes for postgresql string quoting.
- Performance fixes for large response bodies.

Does this release include the publicized authentication bug fix? if so, seems like that would be notable enough to include here.
Shouldn’t touch behavior be default for updated_at for all has_many associations?
Thank you for the release. Any new estimations regarding Rails 3?
Will this be the last release before 3.0?
Thanks (again) for all the hard work!
@Rizwan Reza
Definitely not. Here is one example. class has_many students. Just because a class gets moved to a different room doesn’t mean that any of the students changed.
Thanks a lot!
Nice release to play with in this vacation weeks. Thank You all for it.
Looks pretty neat, time to upgrade again.
A :primary_key option for belongs_to was exactly what I needed today… and here it is!
Thank you guys for all the hard work.
Nice work! Thanks David!
This is nice, but am I the only person all of a sudden getting?
ArgumentError (A copy of XXX has been removed from the module tree but is still active!)
I noticed changes were made with class reloading. I’m not doing anything tricky. I’m mainly getting this with helpers modules and what not. I know turning cache-classes on for development solves the problem, but this just seems odd as I was not getting this before.
@donnie I doubt it. As we get closer to 3.0, there will probably be another release with some transitional help (deprecation warnings etc.)
Thank you guys! David and all the Rails core team and Contributors. We were all waiting for Rails 2.3.3! :-)
Great work!! I already upgraded.
hm, load order change borked my tests.
NoMethodError: undefined method `abstract_class?’ for Object:Class
@Ben Johnson I got this error too (with XXX == ApplicationController), but also other ones, which I cannot reproduce reliably, like SQLite3::BusyException and NoMethodError Exceptions from RESTful_ACL. This only happens on pages having images which are generated by Rails…
There’s an issue for me when I try to install on Win32 platform. It’s solved by modifying some files, instructions here – http://allaboutruby.wordpress.com/2009/07/20/installing-rails-on-windows-3-years-later/
I’m having a problem with array parameters in tests…
http://pastie.org/552640
Anyone else seeing this?
All my problems disappear if I revert this commit: http://github.com/rails/rails/commit/bc2c4a45959be21e6314fba7876b32c1f04cd08a – I will a but eventually.
I meant “file a bug”, sorry for the typo.
@Corky – I posted a comment on your blog, but figured others here could use the info as well.
The issue you saw with Gem.bin_path on Windows is a known issue with RubyGems, which has been fixed in trunk.
Ref: http://rubyforge.org/tracker/index.php?func=detail&aid=26458&group_id=126&atid=575
Nice work! Thanks a lot.
Thank you very much guys for this great release.
I like bug fixes made! Hope they will help to avoid workarounds using.
Pl. start blogging on Rails 3, and start up a website devoted to Rails 3 as discussed by Matt last month here, based on Uservoice requests.
When are we getting BETA..? Actually how far are we from Rails 3…? What percentage level of completion is achieved so far from Dec 23rd to July 23rd ( almost 7 months )..? It would boost up our morals, with a short answer if possible.
Pl. keep us updated on progress…
Thanks
Thanks for the release. That was a heavy delivery…
Thanks for the new version. The AR::Base#to_xml changes look great!
I dunno if “Thread-safety fixes for postgresql string quoting,” if right. Anyone care to response to my comments at http://github.com/rails/rails/commit/c5c022c705e4179f74e063186ea68a1c58797822#comment_25798 ?
Thank you for the release.
Great work guys. Cheers!
Good to see 2.3 is still getting some attention.
I’m still getting the following in certain circumstances:
You have a nil object when you didn’t expect it! The error occurred while evaluating nil.call
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/named_scope.rb:102
As well as:
can’t dup NilClass
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb
Sorry, that last line should have been:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:2184:in `dup’
Yeah! Thanks guys…
As far as I can tell this is the first version of Rails to require the Rack gem (by the actionpack gem). Seems like a change worthy of the release notes to me.
If you clone Rails to vendor/rails from the source in the Rails GitHub repository like I do, you’ll also have to unpack the rack gem to vendor/gems to make your Rails project work properly.
Awesome work Rails team. We appreciate the hard work that’s put into this.
@dhh – Perhaps a blog post when you have a (spare, very spare) moment about how we can help with the transition to Rails 3 (documentation assistance, screencasts, quick how-to’s) – whatever is needed.
Thanks again!
Awesome work guys. Where can I find a full list of fixes? I see the default_scope/named_scope order bug is fixed, huzzah! :) But unordered validation messages are not. :( Just wondering what other goodies are in there. Cheers.
So 2.3.3 breaks existing apps that use the JSON gem by changing the behavior of to_json.
Gracias, por el aporte, verdaderamente esta progresando la aplicacion, y verdaderamente necesitamos un libro mas adecuado con la actualizacion a la version 2.3
Rails Rock