https://github.com/uvera/trackstamps-reborn
Track which user created or updated record in Rails.
https://github.com/uvera/trackstamps-reborn
activerecord hacktoberfest rails ruby
Last synced: about 1 year ago
JSON representation
Track which user created or updated record in Rails.
- Host: GitHub
- URL: https://github.com/uvera/trackstamps-reborn
- Owner: uvera
- License: mit
- Created: 2022-10-17T13:45:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-01T13:17:17.000Z (about 1 year ago)
- Last Synced: 2025-06-08T23:27:38.732Z (about 1 year ago)
- Topics: activerecord, hacktoberfest, rails, ruby
- Language: Ruby
- Homepage:
- Size: 98.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# trackstamps-reborn
[](https://rubygems.org/gems/trackstamps-reborn)
[](https://github.com/uvera/trackstamps-reborn/actions/workflows/test.yml)
Track which user created or updated record in Rails.
Inspired and part of code used from original [Trackstamps](https://github.com/mshahzadtariq/trackstamps) gem
---
- [Quick start](#quick-start)
- [Support](#support)
- [License](#license)
- [Code of conduct](#code-of-conduct)
- [Contribution guide](#contribution-guide)
## Quick start
```
$ bundler install trackstamps-reborn
```
### Hook current_user into CurrentAttributes
```ruby
class ApplicationController < ActionController::Base
before_action :set_trackstamps_user
def set_trackstamps_user
Trackstamps::Reborn::Current.user = current_user
# or use your current attributes class with proc override in initializers
YourCurrentAttributesClass.user = current_user
end
end
```
### Override implementation for current user
```ruby
## filename: config/initializers/trackstamps-reborn.rb
Trackstamps::Reborn.config.get_current_user = -> { YourCurrentAttributesClass.user }
# or
Trackstamps::Reborn[:alternative].config.get_current_user = -> { YourAlternativeCurrentAttributesClass.user }
```
### Generate migrations
```
rails generate trackstamps:reborn:migration table_name
```
## Include trackstamps
```ruby
class Example < ActiveRecord::Base
include Trackstamps::Reborn
# or
include Trackstamps::Reborn[:whatever]
end
```
## Multiple configuration
Multiple configuration is achieved with module builder pattern utilizing `self.[]` method.
Upon calling
```ruby
Trackstamps::Reborn[:whatever]
```
specific module is cached in `::Concurrent::Map` instance.
## Support
If you want to report a bug, or have ideas, feedback or questions about the gem, [let me know via GitHub issues](https://github.com/uvera/trackstamps-reborn/issues/new) and I will do my best to provide a helpful answer. Happy hacking!
## License
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
## Code of conduct
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
## Contribution guide
Pull requests are welcome!