Sha256: 818af1cbffe7497f19449aeaf4009f80f88f350da8dbb41096473856d3d4646c

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 KB

Contents

# rails 3.1+
if defined?(Rails::Railtie)
  module SecureHeaders
    class Railtie < Rails::Engine
      isolate_namespace ::SecureHeaders if defined? isolate_namespace # rails 3.0
      ActionController::Base.send :include, ::SecureHeaders
    end
  end
else
  module ActionController
    class Base
      include ::SecureHeaders
    end
  end

  module SecureHeaders
    module Routing
      module MapperExtensions
        def csp_endpoint
          @set.add_route(ContentSecurityPolicy::FF_CSP_ENDPOINT, {:controller => "content_security_policy", :action => "scribe"})
        end
      end
    end
  end

  if defined?(ActiveSupport::Dependencies)
    if ActiveSupport::Dependencies.autoload_paths
      ActiveSupport::Dependencies.autoload_paths << File.expand_path(File.join("..", "..", "..", "app", "controllers"), __FILE__)
    else
      ActiveSupport::Dependencies.autoload_paths = [File.expand_path(File.join("..", "..", "..", "app", "controllers"), __FILE__)]
    end
  end

  if defined? ActionController::Routing
    ActionController::Routing::RouteSet::Mapper.send :include, ::SecureHeaders::Routing::MapperExtensions
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
secure_headers-1.3.3 lib/secure_headers/railtie.rb
secure_headers-1.3.2 lib/secure_headers/railtie.rb
secure_headers-1.3.1 lib/secure_headers/railtie.rb
secure_headers-1.3.0 lib/secure_headers/railtie.rb
secure_headers-1.2.0 lib/secure_headers/railtie.rb
secure_headers-1.1.1 lib/secure_headers/railtie.rb
secure_headers-1.1.0 lib/secure_headers/railtie.rb
secure_headers-1.0.0 lib/secure_headers/railtie.rb
secure_headers-0.5.0 lib/secure_headers/railtie.rb
secure_headers-0.4.3 lib/secure_headers/railtie.rb
secure_headers-0.4.2 lib/secure_headers/railtie.rb
secure_headers-0.4.1 lib/secure_headers/railtie.rb
secure_headers-0.4.0 lib/secure_headers/railtie.rb
secure_headers-0.3.0 lib/secure_headers/railtie.rb
secure_headers-0.2.1 lib/secure_headers/railtie.rb
secure_headers-0.2.0 lib/secure_headers/railtie.rb
secure_headers-0.1.1 lib/secure_headers/railtie.rb
secure_headers-0.1.0 lib/secure_headers/railtie.rb