Skip to content

mshahzadtariq/trackstamps_mongoid

Repository files navigation

Trackstamps

Track which user created or updated record in rails. This gem depends on devise gem and uses devise ‘current_user’ helper method.

Dependency

This gem depends on devise gem and uses devise ‘current_user’ helper method.

  • Rails

  • Devise

  • Mongoid

Installation

Simply add trackstamps gem to your Gemfile.

gem 'trackstamps_mongoid', git: 'https://github.com/mshahzadtariq/trackstamps_mongoid'

Install bundler gems

bundle install

Install trackstamps

rails generate trackstamps_mongoid:install

Include trackstamps module inside your model class

class Account
    include Trackstamps

    .....

end

And now you are ready to track changes

Usage

It will automatically track record is created or updated by which user. i.e.

Account.last.creator

will return last account was created by which user. Similarily

Account.find_by(title: 'test').updater

will tells us which user updated account ‘test’

Contributing

  1. Fork it

  2. Create your feature branch (‘git checkout -b my-new-feature`)

  3. Commit your changes (‘git commit -am ’Added some feature’‘)

  4. Push to the branch (‘git push origin my-new-feature`)

  5. Create new Pull Request

About

Track which user created or updated record in rails with mongoid ORM. This gem depends on devise gem and uses devise 'current_user' helper method.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published