Skip to content

Conversation

@kalashnikovisme
Copy link
Member

Motivation

  • Provide form-level validation support analogous to normalizes so forms can validate inputs before saving.
  • Ensure validations can be inherited and combined across form subclasses and integrated into the existing submit flow.

Description

  • Add lib/tramway/forms/validations.rb implementing validates, validations, inheritance merging, and an __apply_validations method.
  • Integrate validations into Tramway::BaseForm by requiring and including the module, initializing validations on inherited, applying validations during __submit, and making submit/submit! respect validation errors.
  • Add example usage to README.md and guidance to docs/AGENTS.md about using form-level validates.
  • Update dummy forms in spec/dummy/app/forms to declare validations and add spec/forms/validations_form_spec.rb to exercise validation behavior and inheritance.

Testing

  • Added spec/forms/validations_form_spec.rb covering invalid attributes, allow_nil behavior, and validation inheritance.
  • Attempted to run bundle exec rspec spec/forms/validations_form_spec.rb but the environment lacked bundler/rspec executables so the test run could not be executed here.

Codex Task

@kalashnikovisme kalashnikovisme merged commit 3a31199 into main Feb 1, 2026
16 of 18 checks passed
@kalashnikovisme kalashnikovisme deleted the codex/implement-validations-for-forms branch February 1, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants