In Rails, getting the request object by default is not possible. There are a few ways we can do this and today’s tip shows one.

before_filter :store_request_in_thread
 
def store_request_in_thread
  Thread.current[:request] = request
end

:)

Leave a Reply

Your email address will not be published. Required fields are marked *