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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With