LoginTracker is a gem that tracks logins of each user.
Add this line to your application's Gemfile:
gem 'devise-login_tracker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install devise-login_tracker
Run the generator with the model name (User in this example):
$ rails g devise_login_tracker User
Add :login_tracker
to devise
in your model and association
to the login records. Example for User model:
class User < ActiveRecord::Base
devise :database_authenticatable, ..... , :login_tracker
has_many :logins, class_name: 'UserLogin'
end
For each login new record is created with following attributes:
ip_address
- IP addressuser_agent
- User agentsigned_in_at
- Signed in atsigned_in_at
- Signed out at (upon sign out)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright © 2013 Blueberry.cz Apps s.r.o. See LICENSE for details.