Big first commit
authentication-zero and first layout
This commit is contained in:
11
app/models/session.rb
Normal file
11
app/models/session.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class Session < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
before_create do
|
||||
self.user_agent = Current.user_agent
|
||||
self.ip_address = Current.ip_address
|
||||
end
|
||||
|
||||
after_create { user.events.create! action: "signed_in" }
|
||||
after_destroy { user.events.create! action: "signed_out" }
|
||||
end
|
||||
Reference in New Issue
Block a user