I have an Active Resource that I query for data. It returns records, counts, whatever I ask for.
eg: product = Product.find(123)
The response headers supposedly contain a custom attribute, say "HTTP_PRODUCT_COUNT=20" and I would like to examine the response.
What would be the most efficient way of doing this from IRB? I don't have the luxury of Rails or other frameworks that might provide the underlying response.
Do I need to hack Net::HTTP or ActiveResource itself with a monkeypatched call or something?
also you can try this gem https://github.com/Fivell/activeresource-response
Here's one way to do it without monkeypatching.
If you change certain class fields like site, ARes will re-assign the connection field with a new Connection object. To see when this happens, search active_resource/base.rb for where @connection is set to nil. In these cases you'll have to assign the connection again.
UPDATE: Here's a modified MyConn that should be thread-safe. (re-edited with fivell's suggestion)