https://github.com/state-machines/state_machines-activemodel
StateMachines ActiveModel Integration
https://github.com/state-machines/state_machines-activemodel
Keywords
activemodel ruby state-machine
Keywords from Contributors
activerecord activejob mvc rubygems sinatra rack ruby-gem data-validation rubocop mongodb-driver
Last synced: about 23 hours ago
JSON representation
Repository metadata
StateMachines ActiveModel Integration
- Host: GitHub
- URL: https://github.com/state-machines/state_machines-activemodel
- Owner: state-machines
- License: mit
- Created: 2014-04-29T16:41:17.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2026-03-22T22:48:06.000Z (about 1 month ago)
- Last Synced: 2026-03-23T11:45:30.331Z (about 1 month ago)
- Topics: activemodel, ruby, state-machine
- Language: Ruby
- Homepage:
- Size: 162 KB
- Stars: 35
- Watchers: 4
- Forks: 32
- Open Issues: 0
- Releases: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
README.md
StateMachines ActiveModel Integration
The ActiveModel integration is useful for both standalone usage and for providing
the base implementation for ORMs which implement the ActiveModel API. This
integration adds support for validation errors and dirty attribute tracking.
Installation
Add this line to your application's Gemfile:
gem 'state_machines-activemodel'
And then execute:
$ bundle
Or install it yourself as:
$ gem install state_machines-activemodel
Dependencies
Active Model 7.1+
Usage
class Vehicle
include ActiveModel::Dirty
include ActiveModel::Validations
attr_accessor :state
define_attribute_methods [:state]
state_machine initial: :parked do
before_transition parked: any - :parked, do: :put_on_seatbelt
after_transition any: :parked do |vehicle, transition|
vehicle.seatbelt = 'off'
end
around_transition :benchmark
event ignite: do
transition parked: :idling
end
state :first_gear, :second_gear do
validates :seatbelt_on, presence: true
end
end
def put_on_seatbelt
...
end
def benchmark
...
yield
...
end
end
Contributing
- Fork it ( https://github.com/state-machines/state_machines-activemodel/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Owner metadata
- Name: State Machines
- Login: state-machines
- Email:
- Kind: organization
- Description:
- Website:
- Location: Antarctica
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/7613709?v=4
- Repositories: 11
- Last ynced at: 2023-09-07T15:13:42.457Z
- Profile URL: https://github.com/state-machines
GitHub Events
Total
- Release event: 2
- Delete event: 10
- Pull request event: 23
- Issues event: 1
- Watch event: 1
- Issue comment event: 10
- Push event: 37
- Pull request review comment event: 1
- Pull request review event: 2
- Create event: 14
Last Year
- Release event: 2
- Delete event: 8
- Pull request event: 19
- Issues event: 1
- Watch event: 1
- Issue comment event: 8
- Push event: 31
- Pull request review event: 1
- Pull request review comment event: 1
- Create event: 12
Committers metadata
Last synced: 19 days ago
Total Commits: 93
Total Committers: 19
Avg Commits per committer: 4.895
Development Distribution Score (DDS): 0.484
Commits in past year: 28
Committers in past year: 4
Avg Commits per committer in past year: 7.0
Development Distribution Score (DDS) in past year: 0.429
| Name | Commits | |
|---|---|---|
| Abdelkader Boudih | t****e@g****m | 48 |
| Rafael Mendonça França | r****a@g****m | 16 |
| github-actions[bot] | 4****] | 6 |
| GitHub Action | a****n@g****m | 5 |
| Olle Jonsson | o****n@g****m | 3 |
| Edouard CHIN | e****n@s****m | 2 |
| Cédric Boutillier | c****r@g****m | 1 |
| Dima S | d****h@n****m | 1 |
| Jean Boussier | j****r@g****m | 1 |
| Jean byroot Boussier | j****b@s****m | 1 |
| Jimmy Bourassa | j****a@g****m | 1 |
| Joel Van Horn | 1****h | 1 |
| John Hawthorn | j****n@s****m | 1 |
| Justin Coyne | j****e@j****m | 1 |
| Nicholas La Roux | l****n@g****m | 1 |
| Nick Coyne | n****k@c****m | 1 |
| Thomas Walpole | t****e@g****m | 1 |
| Vanboom | d****m@h****m | 1 |
| Washington Luiz | h****o@g****m | 1 |
Committer domains:
- shopify.com: 2
- codevader.com: 1
- justincoyne.com: 1
- stembolt.com: 1
- nedap.com: 1
- github.com: 1
Issue and Pull Request metadata
Last synced: 25 days ago
Total issues: 7
Total pull requests: 51
Average time to close issues: over 1 year
Average time to close pull requests: about 1 month
Total issue authors: 7
Total pull request authors: 18
Average comments per issue: 1.71
Average comments per pull request: 0.35
Merged pull request: 43
Bot issues: 0
Bot pull requests: 5
Past year issues: 1
Past year pull requests: 15
Past year average time to close issues: 3 months
Past year average time to close pull requests: about 1 hour
Past year issue authors: 1
Past year pull request authors: 2
Past year average comments per issue: 4.0
Past year average comments per pull request: 0.13
Past year merged pull request: 14
Past year bot issues: 0
Past year bot pull requests: 5
Top Issue Authors
- jcoyne (1)
- koluku (1)
- mingan (1)
- boutil (1)
- devilankur18 (1)
- vanboom (1)
- mlarraz (1)
Top Pull Request Authors
- seuros (22)
- github-actions[bot] (5)
- olleolleolle (3)
- Edouard-chin (2)
- casperisfine (2)
- boutil (2)
- coddeys (2)
- vanboom (2)
- larouxn (2)
- twalpole (1)
- nickcoyne (1)
- jhawthorn (1)
- joelvh (1)
- rafaelfranca (1)
- jcoyne (1)
Top Issue Labels
Top Pull Request Labels
- autorelease: pending (3)
- autorelease: tagged (2)
Package metadata
- Total packages: 12
-
Total downloads:
- rubygems: 132,778,903 total
- Total docker downloads: 868,541,566
- Total dependent packages: 7 (may contain duplicates)
- Total dependent repositories: 2,855 (may contain duplicates)
- Total versions: 60
- Total maintainers: 2
gem.coop: state_machines-activemodel
Adds support for creating state machines for attributes on ActiveModel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: http://www.rubydoc.info/gems/state_machines-activemodel/
- Licenses: MIT
- Latest release: 0.102.0 (published about 1 month ago)
- Last Synced: 2026-04-13T18:31:03.128Z (17 days ago)
- Versions: 25
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 66,397,995 Total
- Docker Downloads: 434,270,783
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.183%
- Docker downloads count: 0.305%
- Downloads: 0.427%
- Maintainers (2)
debian-13: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: https://packages.debian.org/trixie/ruby-state-machines-activemodel
- Licenses: mit
- Latest release: 0.9.0-1 (published 3 months ago)
- Last Synced: 2026-03-14T18:11:35.847Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.763%
- Forks count: 1.127%
- Stargazers count: 1.927%
rubygems.org: state_machines-activemodel
Adds support for creating state machines for attributes on ActiveModel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: http://www.rubydoc.info/gems/state_machines-activemodel/
- Licenses: MIT
- Latest release: 0.102.0 (published about 1 month ago)
- Last Synced: 2026-04-12T09:51:49.745Z (18 days ago)
- Versions: 25
- Dependent Packages: 7
- Dependent Repositories: 2,855
- Downloads: 66,380,908 Total
- Docker Downloads: 434,270,783
-
Rankings:
- Docker downloads count: 0.36%
- Downloads: 0.459%
- Dependent repos count: 0.59%
- Dependent packages count: 2.237%
- Average: 2.896%
- Forks count: 4.493%
- Stargazers count: 9.239%
- Maintainers (2)
ubuntu-22.04: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses:
- Latest release: 0.8.0-3 (published 3 months ago)
- Last Synced: 2026-03-13T13:37:27.099Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses:
- Latest release: 0.8.0-3 (published 3 months ago)
- Last Synced: 2026-03-13T19:24:49.139Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: https://packages.debian.org/buster/ruby-state-machines-activemodel
- Licenses:
- Latest release: 0.5.1-3 (published 3 months ago)
- Last Synced: 2026-03-13T19:07:57.124Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses:
- Latest release: 0.5.1-3 (published 3 months ago)
- Last Synced: 2026-03-13T14:25:30.156Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: https://packages.debian.org/bullseye/ruby-state-machines-activemodel
- Licenses:
- Latest release: 0.7.1-2 (published 3 months ago)
- Last Synced: 2026-03-14T07:18:54.121Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses:
- Latest release: 0.8.0-3 (published 3 months ago)
- Last Synced: 2026-03-11T15:30:37.610Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.10: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses:
- Latest release: 0.9.0-1 (published 3 months ago)
- Last Synced: 2026-03-09T18:23:08.489Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Documentation: https://packages.debian.org/bookworm/ruby-state-machines-activemodel
- Licenses:
- Latest release: 0.8.0-3 (published 3 months ago)
- Last Synced: 2026-03-13T23:47:20.372Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.04: ruby-state-machines-activemodel
- Homepage: https://github.com/state-machines/state_machines-activemodel
- Licenses: mit
- Latest release: 0.8.0-3 (published 3 months ago)
- Last Synced: 2026-03-13T02:09:26.261Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- pry-byebug >= 0
- appraisal >= 1 development
- bundler >= 1.6 development
- minitest ~> 5.4 development
- minitest-reporters >= 0 development
- rake >= 10 development
- activemodel >= 5.1
- state_machines >= 0.5.0
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- actions/checkout v4 composite
- googleapis/release-please-action v4 composite
Score: 27.22437574522693