{"id":18907769,"url":"https://github.com/infraspecdev/state_machines_transactions","last_synced_at":"2025-10-17T14:59:41.682Z","repository":{"id":185013620,"uuid":"672804760","full_name":"infraspecdev/state_machines_transactions","owner":"infraspecdev","description":"A ruby gem which persists the state transitions of the state_machines gem.","archived":false,"fork":false,"pushed_at":"2023-07-31T11:10:17.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-31T11:57:25.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infraspecdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-31T07:53:15.000Z","updated_at":"2023-07-31T07:54:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"d5df3395-27ee-4fa7-ad25-87dd0b806380","html_url":"https://github.com/infraspecdev/state_machines_transactions","commit_stats":null,"previous_names":["infraspecdev/state_machines_transactions"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fstate_machines_transactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fstate_machines_transactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fstate_machines_transactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fstate_machines_transactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infraspecdev","download_url":"https://codeload.github.com/infraspecdev/state_machines_transactions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239891331,"owners_count":19714122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T09:23:10.213Z","updated_at":"2025-10-17T14:59:41.580Z","avatar_url":"https://github.com/infraspecdev.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StateMachinesTransactions\nThis 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.\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"state_machines_transactions\"\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install state_machines_transactions\n```\n\n## Usage\nGenerate the database migration for state_machines_transactions table using:\n```bash\n$ rails generate state_machine_transactions\n```\n\nAnd then execute:\n```bash\n$ rails db:migrate\n```\n\nAdd `audit_transition` inside your state machine to persist the state transitions.\n```ruby\nstate_machine :state, initial: :parked do\n    audit_transition\n\n    state :parked\n    state :idling\nend\n```\n\nUse `StateMachinesTransaction` model to fetch the transactions. The schema is:\n```ruby\n  create_table \"state_machines_transactions\", force: :cascade do |t|\n    t.string \"object_type\"\n    t.integer \"object_id\"\n    t.string \"state_field\"\n    t.string \"event\"\n    t.string \"from_state\"\n    t.string \"to_state\"\n    t.string \"status\"\n    t.datetime \"created_at\", null: false\n    t.datetime \"updated_at\", null: false\n  end\n```\n\n## Contributing\n1. Fork it ( https://github.com/infraspecdev/state_machines_transactions/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfraspecdev%2Fstate_machines_transactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfraspecdev%2Fstate_machines_transactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfraspecdev%2Fstate_machines_transactions/lists"}