require 'act_form/version' require 'act_form/model' require 'act_form/runnable' module ActForm class Base include Model end class RecordForm < Base attr_reader :record def initialize(record, **attrs) @record = record @extract_attrs = @record.attributes.extract! *self.class.attribute_set.map(&:name).map(&:to_s) super(@extract_attrs.merge(attrs)) end def save if valid? sync(@record) @persisted = @record.save else false end end end class Command < Base include Runnable private_class_method :new end end require 'act_form/railtie' if defined?(Rails)