NoBrainerORM / nobrainer

Ruby ORM for RethinkDB
http://nobrainer.io/
Other
387 stars 49 forks source link

Is there a way to use outdated reads globally? #218

Closed scottrobertson closed 8 years ago

scottrobertson commented 8 years ago

We have an app that needs to be available when only outdated reads are available. Is there a way to configure NoBrainer to use this for all reads?

nviennot commented 8 years ago

You can use a rack middleware or a controller around filter with a NoBrainer.run_with(:use_outdated => true) { ... }. Would that be an acceptable solution?

nviennot commented 8 years ago

I've added the following option to the configuration file:

# Configures the run options passed to r.run() when executing queries.
# The options are listed in the RethinkDB run() documentation.
# The default durability is :soft for development or test environments, otherwise :hard.
# config.run_options = { :durability => config.default_durability, :read_mode => :single }
scottrobertson commented 8 years ago

Perfect @nviennot, thank you! Option 1 would not have worked, as it needs to be the entire app, including the devise plugins etc. So this should work very well.