Bug with serialized columns in console?

Hi,

I recently added 2 serialized columns in my class Server :

class Server < ActiveRecord::Base

serialize :visa, Hash
serialize :appli, Array

No problem in my controller and my application and everything works as
expected : Excel exports following the “visa” Hash or “appli” Array
are ok.

But since I added the visa Hash, I can’t load the record with such a
serialized column in the console window :

s=Server.find_by_nom “a_server”
ActiveRecord::SerializationTypeMismatch: visa was supposed to be a
Hash, but was a String
from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/attribute_methods.rb:244:i
n unserialize_attribute' from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/attribute_methods.rb:216:i nread_attribute’
from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/base.rb:2152:in attribute _for_inspect' from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/base.rb:2229:ininspect’
from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/base.rb:2227:in collect' from D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/base.rb:2227:ininspect’
from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:298:in
output_value' from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:151:ineval_input’
from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:259:in
signal_status' from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:147:ineval_input’
from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:146:in
eval_input' from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:70:instart’
from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:69:in
catch' from D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/irb.rb:69:instart’
from D:/InstantRails-2.0-win/ruby/bin/irb:13

Any Idea ? Is it a bug ?

Thanks a lot for your help.
Come

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs