Sha256: fd72462488252aed52646ed9fc03f48c61094a0d45ef084ece22eaddfc263831

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

class New<%= model_name %>Form < ROM::Model::Form
  commands <%= relation %>: :create

  input do
    set_model_name '<%= model_name %>'

    # define form input attributes
    # attribute :name, String

    timestamps
  end

  validations do
    relation :<%= relation %>

    # Add form validations
    # validates :name, presence: true
  end

  def commit!
    <%= relation %>.try { <%= relation %>.create.call(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/new_form.rb.erb
rom-rails-0.3.0.rc1 lib/generators/rom/form/templates/new_form.rb.erb