tapajos/highrise — Issue #31: Set site/user fields thread safe manner?
Author: spolpl
Created: 2011-12-17 06:52:57+00:00
State: open

Hi Tapajos,

I am building my first sinatra app that will use highrise gem to access highrise data. The example code to use this gem from the wiki

require 'highrise'

Highrise::Base.site = 'https://your_site.highrisehq.com'
Highrise::Base.user = 'api-auth-token'

But I want to change user and site field for every request. Because each request can be from different user. Currently these are class variables. Even if I set these fields for every request, wouldn't this cause race conditions when there are multiple requests in a multi threading scenario? This might not even be a question specific to your gem, its more of an acriveresource related question. Could you suggest what are the best practices around setting user/site fields for every request in a threadsafe manner?