5

I am building a sinatra app that will use Highrise CRM 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' 

I want to change user and site field for every request, since each request can be for a 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? Could anybody suggest best practices around setting user/site fields for every request in a threadsafe manner?

CodeSmith
  • 2,133
  • 1
  • 20
  • 43
  • You might want to take a look at this question: http://stackoverflow.com/questions/8088126/is-it-thread-safe-to-set-active-resource-http-authentication-on-a-per-user-basis – Mark Amerine Turner Dec 23 '11 at 07:38
  • Thanks Mark. I have posted a follow up question here - http://stackoverflow.com/questions/8623204/set-site-user-fields-in-activeresource – user1112996 Dec 24 '11 at 06:53

0 Answers0