1
0
Fork 0

Log user sessions

This commit is contained in:
Alex Kotov 2019-09-03 18:52:49 +05:00
parent 6783b84bdb
commit b3ca6b0e59
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 22 additions and 1 deletions

View file

@ -14,7 +14,9 @@ class Users::SessionsController < Devise::SessionsController
# POST /resource/sign_in
def create
super
super do |user|
LogUserSession.call user: user
end
end
# DELETE /resource/sign_out

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
class LogUserSession
include Interactor
def call
Session.create!(
account: context.user.account,
ip_address: context.user.current_sign_in_ip,
)
end
end

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe LogUserSession do
pending "add some examples to (or delete) #{__FILE__}"
end