Class: Super::Form::SchemaTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/super/form/schema_types.rb

Overview

This schema type is used on your #edit and #new forms

Note: The constants under “Defined Under Namespace” are considered private.

class MemberDashboard
  # ...

  def new_schema
    Super::Schema.new(Super::Form::SchemaTypes.new) do |fields, type|
      fields[:name] = type.generic("write_type_text")
      fields[:rank] = type.generic("write_type_select", collection: Member.ranks.keys)
      fields[:position] = type.generic("write_type_text")
      fields[:ship_id] = type.generic(
        "write_type_select",
        collection: Ship.all.map { |s| ["#{s.name} (Ship ##{s.id})", s.id] },
      )
    end
  end

  # ...
end

Defined Under Namespace

Classes: Generic

Instance Method Summary collapse

Instance Method Details

#generic(partial_path, extras = nil) ⇒ Object



41
42
43
44
# File 'lib/super/form/schema_types.rb', line 41

def generic(partial_path, extras = nil)
  extras ||= {}
  Generic.new(partial_path: partial_path, extras: extras)
end