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

state_machines_transactions

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

state_machines_transactions

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

StateMachinesTransactions

This gem persists the state transitions of state_machines gem. The transactions (transition data) can be used to represent the path a stateful object took to reach the current state.

Installation

Add this line to your application's Gemfile:

gem "state_machines_transactions"

And then execute:

$ bundle

Or install it yourself as:

$ gem install state_machines_transactions

Usage

Generate the database migration for state_machines_transactions table using:

$ rails generate state_machine_transactions

And then execute:

$ rails db:migrate

Add audit_transition inside your state machine to persist the state transitions.

state_machine :state, initial: :parked do
    audit_transition

    state :parked
    state :idling
end

Use StateMachinesTransaction model to fetch the transactions. The schema is:

  create_table "state_machines_transactions", force: :cascade do |t|
    t.string "object_type"
    t.integer "object_id"
    t.string "state_field"
    t.string "event"
    t.string "from_state"
    t.string "to_state"
    t.string "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

Contributing

  1. Fork it ( https://github.com/infraspecdev/state_machines_transactions/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

License

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

FAQs

Package last updated on 31 Jul 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