lib/skylight/probes/action_controller.rb in skylight-1.0.0.beta4 vs lib/skylight/probes/action_controller.rb in skylight-1.0.0.beta5
- old
+ new
@@ -6,15 +6,22 @@
::ActionController::Instrumentation.class_eval do
private
alias append_info_to_payload_without_sk append_info_to_payload
def append_info_to_payload(payload)
append_info_to_payload_without_sk(payload)
+ if respond_to?(:rendered_format)
+ rendered_mime = rendered_format
+ else
+ format = lookup_context.formats.first
+ rendered_mime = Mime[format.to_sym] if format
+ end
+ payload[:rendered_format] = rendered_mime.try(:ref)
payload[:variant] = request.respond_to?(:variant) ? request.variant : nil
end
end
- #if RAILS_VERSION < 4.2.1
+ if Gem::Version.new(Rails.version) < Gem::Version.new('4.2.1')
# Backport https://github.com/rails/rails/pull/17978
::ActionController::Instrumentation.class_eval do
def process_action(*args)
raw_payload = {
:controller => self.class.name,
@@ -35,10 +42,10 @@
ensure
append_info_to_payload(payload)
end
end
end
- #end
+ end
end
end
end
end