Sha256: cd39a2fcf6ad7470811dcff543df355c9f7f1876931608b1b42e5d996d42e0e0
Contents?: true
Size: 683 Bytes
Versions: 12
Compression:
Stored size: 683 Bytes
Contents
module Lurker class Sandbox def initialize(app) @app = app end def call(env) orig_path = env['PATH_INFO'] if orig_path.ends_with?('.js') || orig_path.ends_with?('css') || orig_path.ends_with?('css.map') @result = @app.call(env) else ActiveRecord::Base.transaction do @result = @app.call(env) raise ActiveRecord::Rollback if called_from_lurker?(env) end end @result end private def called_from_lurker?(env) return false if (referer = env['HTTP_REFERER']).blank? url = URI.parse referer url.path.starts_with? "/#{Lurker::DEFAULT_URL_BASE}" end end end
Version data entries
12 entries across 12 versions & 1 rubygems