Sha256: aff55dc26bad30932f6c8edbc5ffdce31c09985fc0afe964fd278e5f89a1881c
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
module Samsara::Controller extend ActiveSupport::Concern included do before_filter :set_samsara_context after_filter :unset_samsara_context end def set_samsara_context return unless Samsara.active? Samsara.current_context = build_samsara_context end def unset_samsara_context Samsara.current_context = nil end def build_samsara_context Samsara.context_class.new.tap do |c| c.event = build_samsara_http_request c.application_name = application_name_for_samsara c.environment_name = environment_name_for_samsara end end def build_samsara_http_request Samsara.request_class.build_from(self) end def environment_name_for_samsara Rails.env end def application_name_for_samsara Rails.application.class.parent.name end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
samsara-0.0.3 | lib/samsara/controller.rb |
samsara-0.0.2 | lib/samsara/controller.rb |