Sha256: f13886cd11b84b7d6fc81e7322cd5396aac0e85b33cd95a307111bdf32f61e3c
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
module HyperAdmin module DSL class Form def initialize(resource_class) @resource_class = resource_class @fields = [] end def field(attribute, type: infer_type(attribute), human: human_name(attribute)) @fields << { attribute: attribute, type: type, human: human } end private def infer_type(attribute) @resource_class.columns_hash[attribute.to_s].type end def human_name(attribute) @resource_class.human_attribute_name attribute end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper_admin-0.4.0 | lib/hyper_admin/dsl/form.rb |