lib/turbo-rails.rb in turbo-rails-1.5.0 vs lib/turbo-rails.rb in turbo-rails-2.0.0.pre.beta.1

- old
+ new

@@ -3,17 +3,26 @@ module Turbo extend ActiveSupport::Autoload mattr_accessor :draw_routes, default: true + thread_mattr_accessor :current_request_id + class << self attr_writer :signed_stream_verifier_key def signed_stream_verifier @signed_stream_verifier ||= ActiveSupport::MessageVerifier.new(signed_stream_verifier_key, digest: "SHA256", serializer: JSON) end def signed_stream_verifier_key @signed_stream_verifier_key or raise ArgumentError, "Turbo requires a signed_stream_verifier_key" + end + + def with_request_id(request_id) + old_request_id, self.current_request_id = self.current_request_id, request_id + yield + ensure + self.current_request_id = old_request_id end end end