Sha256: 955cecd369ac127d836f4b240390641677e4b6d1b8c3e0a138da2477093e4b16

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module SolidusAdmin
  module LastLoginHelper
    def last_login(user)
      return t('solidus_admin.users.last_login.never') if user.try(:last_sign_in_at).blank?

      t(
        'solidus_admin.users.last_login.login_time_ago',
        # @note The second `.try` is here for the specs and for setups that use a
        # custom User class which may not have this attribute.
        last_login_time: time_ago_in_words(user.try(:last_sign_in_at))
      ).capitalize
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/helpers/solidus_admin/last_login_helper.rb
solidus_admin-0.3.1 app/helpers/solidus_admin/last_login_helper.rb
solidus_admin-0.3.0 app/helpers/solidus_admin/last_login_helper.rb