views:

407

answers:

1

Hi there, I'm trying to serialize a simple attribute in an ActiveRecord model, and Rails 2.3.4 doesn't like it.

class Shopper
  serialize :tags
end

>> a = Shopper.new
=> <#Shopper...>

>>a.tags = ['aoeu','stnh']
=> ['aoeu','snth']

>> a.save
=> TypeError: class or module required

anyone know what I'm missing?

+3  A: 

Arf...I thought I could serialize two attributes in one go, but that's not the case:

serialize :tags, :garments   # this is wrong

The second argument is supposed to be the class of the serialized object, so I have to do this:

serialize :tags
serialize :garments

bumsicle.

btelles