What problem does it solve?
This Skill enables the creation of Ruby objects that behave like Active Record models (with validations, form integration, etc.) but do not require a database backend, streamlining the development of form objects, API wrappers, and other non-persisted data structures.
Core Features & Use Cases
- Form Objects: Create complex forms that aggregate data from multiple sources or represent transient data.
- API Wrappers: Build objects that mirror external API responses for easier manipulation within Rails.
- Service Objects: Add validation and model-like behavior to service objects without database coupling.
- Use Case: Develop a
ContactForm object that handles user input, performs validation, and sends an email, all without needing a ContactForm database table.
Quick Start
Create a new Ruby class named ContactForm that includes ActiveModel::Model and defines attr_accessor for name, email, and message, then add presence validations for these attributes.