Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 07/21/2009: Rails 2.3.3 is out

Interesting Things

  • Rails 2.3.3 was released yesterday. It is a minor point release but a notable new feature is a faster decoding backend for JSON.
  • The Evening with Palm webOS event is tonight at 6:30!
  • There is a new mailing list for the Jasmine Javascript testing framework.
  • Braid gotcha be careful when using Braid to checkout a specific branch of a Git repository. If you checkout a repository with Braid, and then later decide that you want to switch to a different branch (i.e. going from master to 2-3-stable with Rails) doing a braid remove vendor/rails is not sufficient! The reason is when you add a external with Braid it also adds a remote branch in your Git repository. If you re-add the external, the old remote will be reused, even if you specify a different branch. To avoid this, remove the remote in addition to removing the external. To view your remotes run git remote and remove a remote with git remove rm some/remote/name.

Weirdness with using serialized with Single Table Inheritance in Rails

If you have a class that uses a serialized categories attribute like this:

class Wibble < ActiveRecord::Base
  serialized :categories
end

You can do:

wibble = Wibble.create!(:categories => ['Restaurants', 'Bars'])
wibble.reload.categories #=> ['Restaurants', 'Bars']

We’ve experienced problems with this once we added single table inheritance (STI) to the Wibble class.

class Thingie < ActiveRecord::Base
end

class Wibble < Thingie
  serialized :categories
end

Now, sometimes reloading a Wibble would return the serialized string instead of the array:

wibble = Wibble.create!(:categories => ['Restaurants', 'Bars'])
wibble.reload.categories #=> "-- n- Restaurantsn- Barsn"

Our solution, while not ideal, was to move the serialized declaration to the STI superclass.

class Thingie < ActiveRecord::Base
  serialized :categories
end

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *