This project is archived and is in readonly mode.
evaluate ActiveResource::Base.site at runtime
Reported by Axel Tetzlaff | March 15th, 2011 @ 11:32 AM
I want to write an API client app for our REST API. The app
serving the API publicizes it over different subdomains for
different clients, i.e.:
clientA.myapp.org/api/people
clientB.myapp.org/api/people
The client app must be able to query any client depending on the
user logged in to the client app.
The set of possible clients is not static and can change any time.
ActiveResource::Base.site is usually set at app startup time,
which makes no sense for me, because I don't know to which client
the first user accessing my client app belongs to yet.
Resetting site with every request is not a solution, because I
think it's not thread safe, since site is a class variable and
shared across all parallel requests.
The solution is imho to make site not a value, but either a function or an object that is capable of calculating the site at runtime.
I hope this makes any sense to you.
Comments and changes to this ticket
-
booamd March 15th, 2011 @ 12:07 PM
Theirs is a living, breathing, ongoing phenomenon spanning more than three centuries.(http://www.bagsairs.com)
-
Axel Tetzlaff March 15th, 2011 @ 03:42 PM
I'm using this to work around - but id does not feel right: http://tardigra.de/mcblog/2008/01/handling-multiple-user-authent.html
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>