Thanks Ashley, but I think we'll need something the works a little lower level to avoid changing our whole codebase.
The repo_read, repo_write thing works for me. I think we'll have to hack the adapter to default to write for write ops, etc. Doesn't look like an especially easy way to do that. On Oct 1, 2:53 pm, Ashley Moran <[email protected]> wrote: > On 30 Sep 2009, at 17:17, Luke Galea wrote: > > > Has anyone found a way to make datamapper split reads and writes to > > different servers (ie: reads against a slave, writes against the > > master??) > > Hi Luke > > If you're feeling adventurous, you could try this as a hack: > > * define two repositories in your DataMapper config, repo_read and > repo_write > > Run this code to read the resource in: > > repository(:repo_read) do > resource = Model.get(1) > end > > and this to save it out: > > repository(:repo_write) do > resource.instance_variable_set("@repository", repository) > resource.save > end > > You may find model.rb (line 560), and resource.rb (line 71) useful to > see how this might work. > > Note - the above is completely untested and may reformat your hard > drive or worse. I take no responsibility for any loss of life or > earnings :) > > Ashley > > --http://www.patchspace.co.uk/http://www.linkedin.com/in/ashleymoranhttp://aviewfromafar.net/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
