W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > May 2011

Re: Spira: method resolution of has_many resources not working sometimes

From: Ben Lavender <ben@dydra.com>
Date: Fri, 20 May 2011 15:19:32 -0500
Message-ID: <BANLkTikvcxtJXL3psg-mMfPSUTsvF8RyiA@mail.gmail.com>
To: Christoph Badura <bad@bsd.de>
Cc: public-rdf-ruby@w3.org
On Fri, May 20, 2011 at 3:12 PM, Christoph Badura <bad@bsd.de> wrote:
> On Fri, May 20, 2011 at 12:11:10PM -0500, Ben Lavender wrote:
>> This is a quirk of Promise. In Ruby 1.8, there is no BasicObject, so
>> Promise fakes it by undefining all of the non-critical methods on
>> Object. When you monkey-patch Object to have a to_zorch, Promise does
>> not pass the method through to the underlying promised thunk, and you
>> get Object's version. In Ruby 1.9 (which I tested, which is why I did
>> not see the same behavior), Promise uses BasicObject, which did not
>> get #to_zorch added to it by adding it to Object. I do not imagine
>> this behavior would happen in any case other than monkey-patching
>> Object itself.
> OK. Thanks for the explanation.  I was already wondering if this was
> different in 1.9.
> I discovered this because Rails monkey-patches Object with e.g. to_param
> which is kinda important.
> I guess another workaround is to removed the methods that Rails monkey-patches
> into Object from Promise.
> It would be nice if that behaviour of promise were documented.

And it's indeed a problem if promise is incompatible with rails in 1.8.x :(

This is the first I've seen the problem, and unfortunately promise
would need some thought on how to best solve it. I'll try and look at
it next hack night. I would really strongly recommend upgrading to 1.9
in any case: 1.8.x is years old, we did all of the RDF.rb development
on 1.9, and it's just faster.

> --chris

Ben Lavender | ben@dydra.com | http://dydra.com
twitter/github: bhuga | +15047221016
Received on Friday, 20 May 2011 20:20:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:15 UTC