Module: Rodauth::Rails::ControllerMethods

Defined in:
lib/rodauth/rails/controller_methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



4
5
6
7
8
9
# File 'lib/rodauth/rails/controller_methods.rb', line 4

def self.included(controller)
  # ActionController::API doesn't have helper methods
  if controller.respond_to?(:helper_method)
    controller.helper_method :rodauth
  end
end

Instance Method Details

#rodauth(name = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rodauth/rails/controller_methods.rb', line 11

def rodauth(name = nil)
  if name
    request.env["rodauth.#{name}"]
  else
    request.env["rodauth"]
  end
end