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

sequel_paper_trail_safehub

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequel_paper_trail_safehub

  • 0.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Sequel plugin for Paper Trail

This is a simple Sequel plugin for PaperTrail (with limited functionality).

Contributions are welcome!

Travis badge Coverage Status License

Features

  • Track when models are created, updated, or deleted
  • specify current_user as whodunnit
  • can be specified info_for_paper_trail
  • versioning can be disabled or enabled globally or in a block context

Limitations

  • this gem doesn't create a version table
  • this is forked from 7 year old code, and I may not accept PRs.
  • info_for_paper_trail is global
  • does not reify

Installation

Add this line to your application's Gemfile:

gem 'sequel_paper_trail', github: 'lambwaves/sequel_paper_trail'

Documentation

Usage

Quick start:


require 'sequel_paper_trail'
require 'sequel'
require 'sequel/plugins/has_paper_trail'

Album.plugin :has_paper_trail, class_name: 'VersionClassName'

class AlbumsController < BaseController
  before_action :set_user_for_papertrail

  def set_user_for_papertrail
    SequelPaperTrail.whodunnit = current_user.id
  end
end

Enable versioning globally:


SequelPaperTrail.enabled = true

Enable versioning for a block of code:


SequelPaperTrail.with_versioning { 'code' }

Disable versioning globally:


SequelPaperTrail.enabled = false

Disable versioning for a block of code


SequelPaperTrail.with_versioning(false) { 'code' }

Set whodunnit:


SequelPaperTrail.whodunnit = 'Mr. Smith'

Set info_for_paper_trail - additional info (Hash) which will be attached to the versions table.

# If you have 'release' and 'instance' columns in a versions table you can populate them.

SequelPaperTrail.info_for_paper_trail = { release: 'asdf131234', instance: `hostname` }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

I specify the location of this gem in my application's Gemfile.

Contributing

I have minimal functionality, so contributions might not be received applicably.

Bug reports and pull requests are welcome on GitHub at https://github.com/lazebny/sequel_paper_trail.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 17 Mar 2023

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