Sha256: cd7da165e3ea4736c1c0a0ab94c6e0db2aafe7ef88f507a061a9cb6556015498
Contents?: true
Size: 461 Bytes
Versions: 2
Compression:
Stored size: 461 Bytes
Contents
class Edit<%= model_name %>Form < ROM::Model::Form commands <%= relation %>: :update input do set_model_name '<%= model_name %>' # define form input attributes # attribute :name, String timestamps :updated_at end validations do relation :<%= relation %> # Add form validations # validates :name, presence: true end def commit! <%= relation %>.try { <%= relation %>.update.by_id(id).set(attributes) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rom-rails-0.3.0 | lib/generators/rom/form/templates/edit_form.rb.erb |
rom-rails-0.3.0.rc1 | lib/generators/rom/form/templates/edit_form.rb.erb |