{"id":21597268,"url":"https://github.com/spheresoftware/state_machine_history","last_synced_at":"2025-07-07T00:38:04.114Z","repository":{"id":1234912,"uuid":"1170624","full_name":"SphereSoftware/state_machine_history","owner":"SphereSoftware","description":"state_machine history for Ruby On Rails applications","archived":false,"fork":false,"pushed_at":"2010-12-21T12:50:25.000Z","size":84,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-08T21:01:08.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SphereSoftware.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-15T09:12:13.000Z","updated_at":"2014-06-21T22:06:06.000Z","dependencies_parsed_at":"2022-07-15T08:51:42.371Z","dependency_job_id":null,"html_url":"https://github.com/SphereSoftware/state_machine_history","commit_stats":null,"previous_names":["sphereconsultinginc/state_machine_history"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/SphereSoftware/state_machine_history","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphereSoftware%2Fstate_machine_history","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphereSoftware%2Fstate_machine_history/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphereSoftware%2Fstate_machine_history/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphereSoftware%2Fstate_machine_history/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SphereSoftware","download_url":"https://codeload.github.com/SphereSoftware/state_machine_history/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphereSoftware%2Fstate_machine_history/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260933089,"owners_count":23084933,"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-24T18:08:35.798Z","updated_at":"2025-06-20T11:03:48.162Z","avatar_url":"https://github.com/SphereSoftware.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= state_machine_history\nstate_machine_history is an extension of the state_machine[https://github.com/pluginaweek/state_machine] gem,\nthat logs transitions between states and allows to check if a state was visited earlier.\n\n== Install\n  gem install state_machine_history\n\n=== Ruby On Rails 2.x\nAdd the gem dependency to environment.rb:\n  ...\n  config.gem 'state_machine_history'\n  ...\nGenerate the migration:\n  script/generate state_machine_history_2 create_machine_history\nRun the migration\n  rake db:migrate\n\n=== Ruby On Rails 3\nIn Gemfile:\n  gem 'state_machine_history'\nGenerate the migration:\n  rails generate state_machine_history create_machine_history\nRun the migration:\n  rake db:migrate\n\n== Usage\nThis gem adds logging function to the state_machine gem.\nSample:\n\n=== Class definition\n\n  class Order\n    state_machine :initial =\u003e :not_selected do\n      # Switch on state machine logging \n      track_history\n\n      event :choose do\n        transition :not_selected =\u003e :selected\n      end\n      event :add_to_basket do\n        transition :selected =\u003e :in_basket\n      end\n      event :pay do\n        transition :in_basket =\u003e :paid\n      end\n      event :to_send do\n        transition :paid =\u003e :sent\n      end\n    end\n  end\n\n=== Using extensions\n\n  order = Order.new\n  # Perform transition (state change is logged)\n  order.choose\n  # Find whether order has visited not_selected state before selected one\n  order.was_there?(:not_selected, :selected) #=\u003e true\n  # Find whether order has visited not_selected state before the current one\n  order.was_there?(:not_selected)  #=\u003e true\n\n== Credits\n\n=== Project Team\n* Mykhaylo Sorochan - Project Manager\n* Dmitriy Landberg - Software Developer\n* Nataliya Shatokhina - Tester\n* Sergey Mostovoy - Extension idea\n\nCopyright (c) 2010 {Sphere Consulting Inc.}[http://www.sphereinc.com], released under the MIT license (see LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspheresoftware%2Fstate_machine_history","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspheresoftware%2Fstate_machine_history","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspheresoftware%2Fstate_machine_history/lists"}