Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paper_trail_actor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paper_trail_actor

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

PaperTrailActor

This gem is an extension to paper_trail gem https://github.com/airblade/paper_trail. That means you need to pre install paper_trail gem. This gem will add one more method actor to instances of PaperTrail::Version that will return you the ActiveRecord object who was responsible for change.

Supported Rails

This Gem only support >= rails 4.1.0 and above versions.

Installation

  1. Add PaperTrailActor to your Gemfile.

gem 'paper_trail_actor'

  1. And then execute:
bundle install

Basic Usage

Basically this gem works on stroring global_id to whodunnit field of PaperTrail::Version table. As this is an additional extension installed, this will not hinder / break existing paper_trail functionalities.

widget = Widget.find 42
widget.versions               # [<PaperTrail::Version>, <PaperTrail::Version>, ...]
v = widget.versions.last

Now you can also store object to PaperTrail.whodunnit=, and if object will be instance of ActiveRecord::Base it will store the global id in the version's whodunnit column.

And you can also retrieve the actually object later just by using method actor.

actor = actor_paper_trail

PaperTrail.whodunnit = actor
PaperTrail.actor

widget.update_attributes :name => 'Wibble'
widget.versions.last.actor

Contributing

  1. Fork it ( https://github.com/[my-github-username]/paper_trail_actor/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 19 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc