Rails 3.2.0: Faster dev mode & routing, explain queries, tagged logger, store
Posted by David January 20, 2012 @ 05:22 PM
So we didn’t quite make the December release date as we intended, but hey, why break a good tradition and start hitting release targets now! In any case, your patience has been worldly rewarded young grasshopper: Rails 3.2 is done, baked, tested, and ready to roll!
I’ve been running on 3-2-stable for a few months working on Basecamp Next and it’s been a real treat. The new faster dev mode in particular is a major step up over 3.1.
Do remember that this is the last intended release series that’s going to support Ruby 1.8.7. The master git branch for Rails is now targeting Rails 4.0, which will require Ruby 1.9.3 and above. So now is a great time to start the work on getting your app ready for the current version of Ruby. Let’s not hang around old versions forever and a Sunday like those Python guys :).
There’s a v3.2.0 tag on Github and we of course we still have the 3-2-stable branch as well. You can see all the glorious details of everything that was changed in our CHANGELOG compilation.
For documentation, we have the 3.2 release notes with upgrade instructions, both the API docs and the guides have been generated for 3.2 as well, and there’s a brand new 3.2-compatible version of Agile Web Development with Rails. A smörgÃ¥sbord indeed!
Note: If you’re having trouble installing the gems under Ruby 1.8.7, you’ve probably hit a RubyGems bug with YAML that’s been fixed in RubyGems 1.8.15. You can upgrade RubyGems using “gem update—system”.
If you can’t be bothered with the full release notes, here’s a reprint of a few feature highlights from when we did the first release candidate:
Faster dev mode & routing
The most noticeable new feature is that development mode got a ton and a half faster. Inspired by Active Reload, we now only reload classes from files you’ve actually changed. The difference is dramatic on a larger application.
Route recognition also got a bunch faster thanks to the new Journey engine and we made linking much faster as well (especially apparent when you’re having 100+ links on a single page).
Explain queries
We’ve added a quick and easy way to explain quieries generated by ARel. In the console, you can run something like puts Person.active.limit(5).explain and you’ll get the query ARel produces explained (so you can easily see whether its using the right indexes). There’s even a default threshold in development mode where if a query takes more than half a second to run, it’s automatically explained inline—how about that!
Tagged logger
When you’re running a multi-user, multi-account application, it’s a great help to be able to filter the log by who did what. Enter the TaggedLogging wrapper. It works like this:
Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
Logger.tagged("BCX") { Logger.info "Stuff" } # Logs "[BCX] Stuff"
Logger.tagged("BCX") do
Logger.tagged("Jason") do
Logger.info "Stuff" # Logs "\[BCX\] \[Jason\] Stuff"
end
end
Active Record Store
Key/value stores are great, but it’s not always you want to go the whole honking way just for a little variable-key action. Enter the Active Record Store:
class User < ActiveRecord::Base
store :settings, accessors: [ :color, :homepage ]
end
u = User.new(color: 'black', homepage: '37signals.com')
u.color # Accessor stored attribute
u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor

Very nice! Looking forward to the faster dev mode
Congrats team :).
Good job! ) Thanks for RoR! ))
Thanks for all your hard work!
Awesome! Looks good.
great many thanks to the development team!
Yeah! Keep calm and keep pushing! ) I love you, rails dev team!
Looking forward to trying out these new features
/highfive! Keep up the good work.
Great work! Excited to give it a spin!
Awesome! Thanks all!
Very cool, very nice! :)
Congrats, dudes and dudettes! Looking forward to upgrading.
Many thanks to Rails Core Team and all the contributors.
Grtttt!!!!!!!!!! excited to to try out new features….
awesome stuff, very nice :)
Hooray!
Another thing is that when config.activerecord.schema_format is set to :sql, you will get a sql dump file instead of a schema.rb. Yay!
Thank you DHH and team!
Look forward to play with it.
@TonyC this goes from 2.x branch… old joke.
bundle blows up on ruby 1.9.3-p0. rvm rails 3.2 ruby 1.9.3-p0.
hemingway:base_app_3.2 chabgood$ bundle Fetching source index for https://rubygems.org/ /Users/chabgood/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
SHAZAMM!!!
Congrats, RoR Team :-)
Congrats on the release! Here’s a little write-up I did on the new modularized association methods: http://blog.hasmanythrough.com/2012/1/20/modularized-association-methods-in-rails-3-2
Looks Great! Rails keeps over delivering every single release.
Seems to require rubygems 1.8.15 or greater… https://github.com/rails/rails/issues/4559
Rails 3 has been nothing but amazing.. thanks to all contributors for this great new release!
W00t! Starting a new project…now!
Queries, not “quieries”. Still good work guys!
Just a word of warning if attempting to update a widely internationalized application.
Most any routing add on (like i18n_routing) will be completely busted by the routing engine switch.
Also, the new SafeBuffer changes will require changes anywhere you are calling a string method on text from a translated key.
i.e. t(‘post.name’).titleize wil fail. t(‘post.name’).to_str.titlelize will work, though.
Love the updates, but there are some caveats that aren’t completely clear from the release notes.
Awasome, thanks a lot to all contributors. RoR family is growing up quickly!!
Well… ActiveSupport::TaggedLogger::ERROR is an uninitialized constant in https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/tagged_logging.rb#L30 (can’t log in with neither Device 1.5.3, nor 2.0.0.rc nor master)
I have problems with ActiveSupport::TaggedLogger::ERROR, but without Devise
Awesome, thanks so much to all the RoR family and friends!
Great work rails dev team, you guys keep me amazed again and again. Love you guys much
The faster dev mode will be great—thanks to everyone who committed code!
je me appontage cette limbes est-ce aisé d’être style dans écrire pur certains sujets partiellement personnels .. e.g ce auxquels vous-même débattez dos votre égérie et pour un détail jouer même jusqu’aux expériences intimes.. est-il facile par le faire parmi irréductible problème d’impuissance ?
very good. if json parser is more faster,it will be better.
Pretty cool stuff.Great work ROR team
Impressive post.Really very useful for me.thanks to ROR team
Great work.
Ruby on Rails make my days for years now and i’m still happy with each new real eases!
Awesome! ;)
Thank you and congratulations! Looking good as always.
Thanks guys for the hard work. Sadly I have to wait until I have time to use/upgrade to 3.2… Anyway the additions look very nice!
thanks ,ROR teams give us new release in chinese new year。
LOVE THE FASTER DEV MODE—THANKS!!!
Rails Bulging…its accommodating all.. rails maybe a super one, not a super fast.
Great work RoR team, updated a production app (after testing, of course) without any problems.
Thank you rails core team
ah, more and more reason to upgrade.. thanks, kalian batu! (last two words are in Indonesian) :P
Great job. Continue with your great art.
Awesome! Thanks ;)
Thankyou Team
Thanks
Many thanks to great ROR team.
The railway speed to release Rails
Thanks RoR team! waiting for “Journey engine” SYNOPSIS )))
I’m getting blank lines in the log output where I’m calling Rails.logger.debug { “print this message”} . Anytime I use the logger in code I get an a blank line. Is anyone else experiencing this. Our team is using 1.9.2 & 1.9.3 with Rails 3.2. This was not happening with Rails 3.1.3
Great work!
Its great to see the dedication for an opensource projects… Hats off to all of you.. Keep up the good work..
Matt:
Looks like curly braces no longer work. you can’t use:
logger.debug {“oh no, curly braces don’t work no more?”}
You have to go with:
logger.debug “oh, now its working”
ROR FTW
Super information it is actually. I’ve been looking for this tips.
Cool news it is surely. Friend on mine has been searching for this update. Victorias Secret Coupon Codes
Super share it is actually. I have been seeking for this content. Victorias Secret Coupon Codes
The application developed in Rails 3.2 is really awesome. Its on speed of rails.. very fast. The query explanations are helping us to decrease long queries. And Tagged logging is helpful especially when there is requirement of parsing logs for some purpose. We as rails community has taken a great step ahead with the new changes done in the application. Thanks for the info!!
This is a test comment, please respect it :) Kuriozitete te ndryshme