Rails ActiveResource HTTP_AUTHORIZATION headers
prblm: ActiveResource in Rails does not allow to add request headers, which is a general way to send authentication information. How to add custom headers to every request sent using ActiveResource?
solution: The ActiveResource has a very poorely written API, which does not provide any hook to provide custom headers to be added. We need to metaprogram our way around it as follows.
Add an entry to application.rb to load all files from app/extensions.
Create a module CustomAuthHeaders and include it in ActiveResource::Base
In the created module override headers method so that, when any request is made from ActiveResource::Base, custom request headers will be added.
https://gist.github.com/1100092
You can copy paste the above mentioned code in respective locations and all of ActiveResource requests will have extra headers as returned by AppAuthHeaders.headers















