{"id":23249528,"url":"https://github.com/wizardone/forminator","last_synced_at":"2026-05-06T04:03:53.765Z","repository":{"id":56847553,"uuid":"97918329","full_name":"wizardone/forminator","owner":"wizardone","description":"Form wizard for Ruby applications","archived":false,"fork":false,"pushed_at":"2017-10-03T08:09:24.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-01T21:38:50.253Z","etag":null,"topics":["dry","form","form-wizard","hanami","persistence","rails","ruby","validations","wizard"],"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/wizardone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-21T07:17:51.000Z","updated_at":"2017-09-21T13:30:13.000Z","dependencies_parsed_at":"2022-09-09T06:21:58.815Z","dependency_job_id":null,"html_url":"https://github.com/wizardone/forminator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wizardone/forminator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fforminator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fforminator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fforminator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fforminator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wizardone","download_url":"https://codeload.github.com/wizardone/forminator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fforminator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"online","status_checked_at":"2026-04-29T02:00:06.602Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dry","form","form-wizard","hanami","persistence","rails","ruby","validations","wizard"],"created_at":"2024-12-19T08:19:49.278Z","updated_at":"2026-05-06T04:03:53.726Z","avatar_url":"https://github.com/wizardone.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forminator\n[![Build Status](https://travis-ci.org/wizardone/forminator.svg?branch=master)](https://travis-ci.org/wizardone/forminator)\n[![codecov](https://codecov.io/gh/wizardone/forminator/branch/master/graph/badge.svg)](https://codecov.io/gh/wizardone/forminator)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'forminator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install forminator\n\n## Usage\nFirst you need to configure the wizard so it knows the object that you\ninteract with (usually a used model). If you like to persist the model you can\nsupply a callable object that takes care of the persistence. Whether you\nwant to persist after each step or after the final one is up to you.\n\n```ruby\nForminator.configure do |config|\n  config.klass = :user\n  config.persist = -\u003e (user) { user.save }\nend\n```\nTo build a form wizard step you need to subclass the `Forminator::Step`\nclass\n\n```ruby\nclass FirstStep \u003c Forminator::Step\n  validations do\n    required(:email) { filled? }\n    required(:password) { filled? }\n  end\n\n  # By default this returns false, so if you want to persist the object\n  # after each step you need to overwrite the method\n  def persist?\n    true\n  end\nend\n```\nThen you can do:\n```ruby\nuser = User.new\nsome_params = { email: 'test@test.com', password: 'ineedtocryptmypassword' }\nFirstStep.(user, some_params)\n=\u003e [{ valid: true }, some_params]\n```\nEach step always returns an array of 2 elements: a hash with the\nvalidity and the initially passed params. This allows for easy chaining\nof events.\n\n\nIf you want to call a custom persistence logic for a certain step you\ncan pass an optionable callable object like so:\n\n```ruby\nclass CustomPersistenceLogic\n  def call(user)\n    # persistence logic goes here\n  end\nend\nuser = User.new\nFirstStep.(user, some_params, persist: CustomPersistenceLogic.new)\n```\nThe callable object will receive the original object that you interact\nwith.\n\nWant to build a whole flow of steps? Just use the `Forminator::Flow`\nclass\n```ruby\nsteps = [FirstStep, SecondStep, LastStep]\nflow = Forminator::Flow.new(steps: steps)\nflow.current_step\n=\u003e FirstStep\nflow.next_step\n=\u003e SecondStep\n```\nYou can also add steps on the way with:\n```ruby\nflow.add(step: IntermediateStep)\n```\nKeep in mind that you can only add steps that inherit from\n`Forminator::Step`.\nYou can also remove steps:\n```ruby\nflow.remove(step: LastStep)\n=\u003e LastStep\n```\nCalling `remove` will return the removed step.\n\n`Forminator` uses `Hanami::Validations` which in it's own term uses\n`Dry::Validation` :heart. You can [refer](https://github.com/hanami/validations) them for a detailed DSL about\nvalidations.\n\n## Development\n\nAfter 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.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/wizardone/forminator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizardone%2Fforminator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwizardone%2Fforminator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizardone%2Fforminator/lists"}