Sha256: d1b5c51b7c468c0f58725b712eb37d56a256e1660ca9ee681ed071c31a58256a

Contents?: true

Size: 638 Bytes

Versions: 25

Compression:

Stored size: 638 Bytes

Contents

class Session < ApplicationRecord
  belongs_to :user
  <%- if options.sudoable? %>
  kredis_flag :sudo, expires_in: 30.minutes
  <%- end -%>

  before_create do
    self.user_agent = Current.user_agent
    self.ip_address = Current.ip_address
  end
  <%- if options.sudoable? %>
  after_create_commit do
    self.sudo.mark
  end
  <%- 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

25 entries across 25 versions & 1 rubygems

Version Path
authentication-zero-2.16.5 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.4 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.3 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.2 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.1 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.16.0 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.9 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.8 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.7 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.6 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.5 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.4 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.3 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.2 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.1 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.15.0 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.14.0 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.13.0 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.12.6 lib/generators/authentication/templates/models/session.rb.tt
authentication-zero-2.12.5 lib/generators/authentication/templates/models/session.rb.tt