Sha256: 89cc2ff2a22c6b76a5e01c448ae3cb569504b942580e9185481e12f69019d4e4

Contents?: true

Size: 456 Bytes

Versions: 6

Compression:

Stored size: 456 Bytes

Contents

class Session < ApplicationRecord
  belongs_to :user

  before_create do
    self.user_agent = Current.user_agent
    self.ip_address = Current.ip_address
  end

  after_create_commit do
    SessionMailer.with(session: self).signed_in_notification.deliver_later
  end
  <%- if options.trackable? %>
  after_create do
    user.events.create! action: "signed_in"
  end

  after_destroy do
    user.events.create! action: "signed_out"
  end
  <%- end -%>
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
authentication-zero-2.16.11 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.10 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.9 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.8 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.7 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.6 lib/generators/authentication/templates/models/session.rb.tt