Chris,

Yeah #method_missing would probably catch the call to #execute, however,
changing the code shouldn't be too hard, as you said.

Would you mind pasting back the master_slave adapter you end up with? I'd
love to add a section on datamapper.org that explains the setup. If you were
to issue a pull request for that repo, that'd be even more awesome of course
;)

cheers
snusnu

On Fri, May 6, 2011 at 13:03, Chris Corbyn <[email protected]> wrote:

> Wow, so simple, thanks! You have honestly saved me an entire night's
> digging around, probably going down the wrong path.
>
> Actually, this helps me with something else I need to do too with a wrapper
> around another object.
>
> Does this still work if I do something like:
>
> repository(:default).adapter.execute("INSERT INTO userlogins (user_id,
> created_at) VALUES (?, ?)", ....)
>
> Or would that actually end up being sent to the slave due to the
> method_missing() falling back to the slave?
>
> We actually have a pool of slaves, but that's easy to implement anyway.
>
> Thanks again, I had been searching for over a day for a solution, amazed
> that there didn't seem to be a plugin.
>
>
>
> El 06/05/2011, a las 20:53, Martin Gamsjaeger escribió:
>
> Chris,
>
> Does this help? https://gist.github.com/280645
>
> cheers
> snusnu
>
> On Fri, May 6, 2011 at 02:18, Chris Corbyn <[email protected]> wrote:
>
>> Hi Guys,
>>
>> We use MySQL replication in production and need to be able to send writes
>> to a known database (currently just one, but potentially it could become a
>> pool) and reads from any of the available databases.  If writes are done to
>> any of the slaves, bad things will happen.
>>
>> This isn't magic, so I'd be amazed if nobody has already tackled this.
>>  Please let me know if anyone knows of a gem for it, or if this is already
>> supported via configuration options.
>>
>> There's a project called Octopus, but it's not ORM agnostic and assumes
>> you're using ActiveRecord.  I can't find anything for DataMapper via Google.
>>
>> Cheers,
>>
>> Chris
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>
>  --
> 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.
>

-- 
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.

Reply via email to