lib/xray/engine.rb in xray-rails-0.1.16 vs lib/xray/engine.rb in xray-rails-0.1.17

- old
+ new

@@ -28,13 +28,20 @@ # Monkey patch ActionView::Template to augment server-side templates # with filepath information. See `Xray.augment_template` for details. ActionView::Template.class_eval do def render_with_xray(*args, &block) path = identifier + view = args.first source = render_without_xray(*args, &block) - suitable_template = path =~ /\.(html|slim|haml)(\.|$)/ && !path.match(/\.(js|json|css)\./) && !path.include?('_xray_bar') + + suitable_template = !(view.respond_to?(:mailer) && view.mailer) && + !path.include?('_xray_bar') && + path =~ /\.(html|slim|haml|hamlc)(\.|$)/ && + path !~ /\.(js|json|css)(\.|$)/ + options = args.last.kind_of?(Hash) ? args.last : {} + if suitable_template && !(options.has_key?(:xray) && (options[:xray] == false)) Xray.augment_template(source, path) else source end @@ -59,11 +66,9 @@ event = ActiveSupport::Notifications::Event.new(*args) controller_name = event.payload[:controller] action_name = event.payload[:action] path = ActiveSupport::Dependencies.search_for_file(controller_name.underscore) - # Reset the request info hash for this request. - # NOTE: Nothing about this is thread-safe. Could this affect anyone in dev mode? Xray.request_info.clear Xray.request_info[:controller] = { :path => path, :name => controller_name,