Class: ROM::Auth::Plugins::AuthenticationEventsPlugin

Inherits:
Plugin
  • Object
show all
Defined in:
lib/rom/auth/plugins/authentication_events_plugin.rb

Defined Under Namespace

Modules: CallbackOverrides Classes: AuthenticationEvent, AuthenticationEventsMigration, Configuration

Instance Attribute Summary

Attributes inherited from Plugin

#configuration, #system

Instance Method Summary collapse

Methods inherited from Plugin

#initialize

Constructor Details

This class inherits a constructor from ROM::Auth::Plugins::Plugin

Instance Method Details

#installObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rom/auth/plugins/authentication_events_plugin.rb', line 11

def install
  system.extend(CallbackOverrides)

  config = configuration

  @mapper = Class.new(ROM::Mapper) do
    relation(config.table_name)
    model(AuthenticationEvent)
    register_as :rom_auth_event
  end

  @relation = Class.new(ROM::Relation[:sql]) do
    dataset(config.table_name)
  end

  @command = Class.new(ROM::Commands::Create[:sql]) do
    register_as :create
    relation(config.table_name)
    result :one
  end
end

#migrate(setup) ⇒ Object



33
34
35
# File 'lib/rom/auth/plugins/authentication_events_plugin.rb', line 33

def migrate(setup)
  AuthenticationEventsMigration.new(system, setup, configuration).run
end