Class: Reform::Contract::Fields

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/reform/contract.rb

Overview

Keeps values of the form fields. What’s in here is to be displayed in the browser! we need this intermediate object to display both “original values” and new input from the form after submitting.

Instance Method Summary collapse

Constructor Details

#initialize(properties, values = {}) ⇒ Fields

Returns a new instance of Fields.



109
110
111
112
# File 'lib/reform/contract.rb', line 109

def initialize(properties, values={})
  fields = properties.inject({}) { |hsh, attr| hsh.merge!(attr => nil) }
  super(fields.merge!(values))  # TODO: stringify value keys!
end