> While upgrading an app to 2.2.1 I noticed a change in the behavior of > serialized attributes in ActiveRecord. > > I have an AR model with a serialized attribute which is used to store either > a fixnum of an array of fixnums. Previously, a single fixnum stored in this > attribute would be returned as a fixnum, however since a recent commit [1] > it is now returned as a string. > > I'm not sure whether is a typical use case, but it doesn't seem like > expected behavior. I started looking at creating a patch but it became > non-trivial as I strayed off into ActiveRecord::ConnectionAdapters::Quoting. > So instead, I thought it better I get some feedback here.
Seems like this should function correctly: >> YAML.dump(1) => "--- 1\n" I assume the database column is ending up with a literal "1" in it, without the yaml prefix? If so, does overwriting your setter method fix that for you? def whatever=(v) write_attribute(:whatever, YAML.dump(v)) end > Cheers, > Paul > > [1] > http://github.com/rails/rails/commit/c94ba8150a726da4a894cd8325ee682a3286ec9f > > > > -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
