Skip to content

Instantly share code, notes, and snippets.

@lucasmartins
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasmartins/ca626d0bfb9fdfcb6cc7 to your computer and use it in GitHub Desktop.
Save lucasmartins/ca626d0bfb9fdfcb6cc7 to your computer and use it in GitHub Desktop.
Through the Roof with Safety
# ... code that builds the calls_hashes Array
# THIS CODE SPAWNS NEW MONGO CONNECTIONS
unless Rails.env.production?
line.calls.with(safe: true).create!(calls_hashes)
else
line.calls.with(write: {w: 'majority'}, safe: true).create!(calls_hashes)
end
# ... code that schedules map&reduce jobs.
@lucasmartins
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment