Sha256: 2014f7c354955a063188c5d36206f1e2f0c87fdb43a82dc8840eb1a4b41cd93c

Contents?: true

Size: 745 Bytes

Versions: 13

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

module Rodauth
  module OAuth
    module ControllerMethods
      def self.included(controller)
        # ActionController::API doesn't have helper methods
        controller.helper_method :current_oauth_account, :current_oauth_application if controller.respond_to?(:helper_method)
      end

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

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

    class Railtie < ::Rails::Railtie
      initializer "rodauth.controller" do
        ActiveSupport.on_load(:action_controller) do
          include ControllerMethods
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rodauth-oauth-1.6.3 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.6.2 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.6.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.5.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.4.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.3.2 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.3.1 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.3.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.2.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.1.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.0.0 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.0.0.pre.beta2 lib/rodauth/oauth/railtie.rb
rodauth-oauth-1.0.0.pre.beta1 lib/rodauth/oauth/railtie.rb