Google Groups

Re: How to encapsulate persistence in a Rails app?


Avdi Grimm Feb 27, 2012 11:28 AM
Posted in group: Objects on Rails
Nice, I'd missed that one.

On Mon, Feb 27, 2012 at 2:07 PM, Adam Guyot <shaol...@gmail.com> wrote:
> If no one has posted this yet:
> https://github.com/raganwald/homoiconic/blob/master/2011/11/COMEFROM.md
> Seems somewhat relevant to this conversation.
>
>
> A
>
>
> On Mon, Feb 27, 2012 at 9:02 AM, Alexandre de Oliveira
> <chaved...@gmail.com> wrote:
>>
>> I'm kinda annoyed with AR lately. As a matter of exercise, I created a gem
>> where I monkey patched Object#method_added, so:
>>
>> class Person; end
>> class PersonMapper < DataMapper::Mapper; attributes :name, :age; end
>>
>> whenever Person has a change in its variables (name, age), the
>> PersonMapper will automatically know it (thought
>> DataMapper::Mapper#unit_of_work and intelligently persist the domain object.
>>
>> The code so
>> far: https://github.com/kurko/datamapper2/blob/master/lib/dm2/unit_of_work/observer_definition.rb
>>
>> It's just food for thought, actually. I not sure that monkey patching
>> Object#method_added would be a good thing in practice.
>>
>> --Alexandre
>
>

--
Avdi Grimm
http://avdi.org

I only check email twice a day. to reach me sooner, go to
http://awayfind.com/avdi