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, :current_account
  end
end

Instance Method Details

#current_account(name = nil) ⇒ Object



11
12
13
# File 'lib/rodauth/rails/controller_methods.rb', line 11

def (name = nil)
  rodauth(name).
end

#rodauth(name = nil) ⇒ Object



15
16
17
# File 'lib/rodauth/rails/controller_methods.rb', line 15

def rodauth(name = nil)
  request.env.fetch ["rodauth", *name].join(".")
end