Sha256: 86a606899fc8d0868f692d4653502a5b5e317b8d71802d7635c8c495f0f1d3cd
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module HoptoadNotifier module Rails module JavascriptNotifier def self.included(base) #:nodoc: base.send(:after_filter, :insert_hoptoad_javascript_notifier) end private def insert_hoptoad_javascript_notifier return unless HoptoadNotifier.configuration.js_notifier path = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'javascript_notifier.erb') host = HoptoadNotifier.configuration.host.dup port = HoptoadNotifier.configuration.port host << ":#{port}" unless port == 80 options = { :file => path, :layout => false, :use_full_path => false, :locals => { :host => host, :api_key => HoptoadNotifier.configuration.api_key, :environment => HoptoadNotifier.configuration.environment_name } } if @template javascript = @template.render(options) else javascript = render_to_string(options) end if response.body.respond_to?(:gsub) response.body = response.body.gsub(/<(head)>/i, "<\\1>\n" + javascript) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hoptoad_notifier-2.3.3 | lib/hoptoad_notifier/rails/javascript_notifier.rb |