Sha256: 7de1c5680a07cf809c8b6b1948560d941685c81e190048192af168b3e0e8f23b
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require "rodauth/rails/version" require "rodauth/rails/railtie" module Rodauth module Rails class Error < StandardError end # This allows the developer to avoid loading Rodauth at boot time. autoload :App, "rodauth/rails/app" @app = nil @middleware = true class << self def rodauth(name = nil) url_options = ActionMailer::Base.default_url_options scheme = url_options[:protocol] || "http" port = url_options[:port] port ||= Rack::Request::DEFAULT_PORTS[scheme] if Gem::Version.new(Rack.release) < Gem::Version.new("2.0") host = url_options[:host] host += ":#{port}" if port rack_env = { "HTTP_HOST" => host, "rack.url_scheme" => scheme, } scope = app.new(rack_env) scope.rodauth(name) end def configure yield self end attr_writer :app attr_writer :middleware def app fail Rodauth::Rails::Error, "app was not configured" unless @app @app.constantize end def middleware? @middleware end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rodauth-rails-0.6.1 | lib/rodauth/rails.rb |
rodauth-rails-0.6.0 | lib/rodauth/rails.rb |