Once you’ve boarded the Rails train, you just know that every stop along the way is going to be a good time. This release candidate is no different and we’ve packed it with loving goodies without making upgrading a hassle.
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
These are just a few of the highlights. The full release notes detail every loving change.
Given that this is a release candidate, we’re ever so eager to hear your feedback. We hope it’ll be a quick RC phase, but please do spoil that plan by reporting bugs.
As always, you install a release candidate by doing gem install rails --pre
.