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/ashleymoran
http://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
-~----------~----~----~----~------~----~------~--~---