modernistik / parse-stack

Parse Server Ruby Client SDK
https://www.modernistik.com/gems/parse-stack/
MIT License
60 stars 20 forks source link

Any example of having two ParseServer connections at same time? #47

Closed taijizhu closed 5 years ago

taijizhu commented 5 years ago

I need to sync data across two parseserver db. Right now, I could not figure out how to open two connections and switch them dynamically.

apersaud commented 5 years ago

Sorry for the delay, this is supported. You can have any number of clients configured, by default all objects use the client with the :default symbol.

Basically every class can point to a different Parse::Client (each pointing to a different server) by overriding their client instance they are using. If you set the proper client on each of the classes, you can then save objects related to those collections independently.

https://www.modernistik.com/gems/parse-stack/Parse/Client/Connectable.html#client-instance_method