Class: Reform::Fields

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/reform/form.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.



284
285
286
287
# File 'lib/reform/form.rb', line 284

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