Class: HyperAdmin::DSL::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/hyper_admin/dsl/form.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_class) ⇒ Form

Returns a new instance of Form.


5
6
7
8
# File 'lib/hyper_admin/dsl/form.rb', line 5

def initialize(resource_class)
  @resource_class = resource_class
  @fields = []
end

Instance Method Details

#field(attribute, type: infer_type(attribute), human: human_name(attribute)) ⇒ Object


10
11
12
# File 'lib/hyper_admin/dsl/form.rb', line 10

def field(attribute, type: infer_type(attribute), human: human_name(attribute))
  @fields << { attribute: attribute, type: type, human: human }
end