If you pass the resource into a block, you can't call a private method on it (unless the block is defined in the context of the receiver, and even that may be a prob for when blocks get tightened up for MRI 1.9). simple as that. If you want this to work, you need to have the behavior of calling the setter method inherited. Sure, you can do Rubyesque "metaprogramming" and just cram the behavior into every model, but I think thats bad code style as well.
Its actually very nice to use blocks, and I can see how this was initially coded that way. Its clean and neat. But coding this type of behavior by having an abstract model that your model inherits from give you lots of benefits. The first being that in this case, the behavior would not be a bug. Jon On Dec 5, 12:32 pm, Michael Klishin <[EMAIL PROTECTED]> wrote: > On 05.12.2008, at 6:23, Jon Hancock wrote: > > > ahh, more side effects of ruby-style "OO" programming. What ever > > happened to inheritance? > > Not sure it has something to deal with inheritance and Rubyesque code > style :) > But it's certainly missing a conditional ;) > > MK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
