[Nitro] Possible BUG in lib/og/relation/has_many.rb (and possible fix)

Aidan Rogers aidan at yoyo.org
Sun Jan 29 16:57:56 EST 2006

In answer to my own question, I've figured this out.

HasManyCollection has an instance variable @member_class which stores  
the Class of whatever this particular collection contains as  
members.  to_yaml doesn't know how to dump a Class object, and so  
raises an exception.

One possible solution to this is for Collection to overwrite the  
to_yaml method.  Another possible solution is for Collection to store  
its member_class as a string, which, when used later, gets converted  
to the appropriate class type.

I'm not sure which is the right approach to take, or whether there is  
a 3rd (better) approach.  Any advice appreciated.  This particular  
bug is a blocker for me, so I will fix it as soon as I get direction  
from the powers that be :-)


On 29/01/2006, at 10:28 PM, Aidan Rogers wrote:

> Bryan,
> Did you ever figure out why to_yaml was complaining?  I still get
> this error, even with the latest version of the repository.
> Aidan
> On 20/01/2006, at 8:30 AM, Bryan Soto wrote:
>>> Strange bug part 2.
>>> Yaml complains with /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:9:in
>>> `to_yaml': can't dump anonymous class Class (TypeError)
>>> Anyone? :-)
>> You make me glad I think I've figured out why the Og unit tests
>> aren't running ;) Will, hopefully, follow up with a patch and/or
>> explanation today.
>> bryan
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

More information about the Nitro-general mailing list