Sha256: 051e365674a05cf259456ac5a4a9adb66081a5166e6a909551e69963df163cb5

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

module FormObject
  class Base::FormBuilder
    attr_reader :mapping_information, :model

    def initialize( mapping_information, model )
      @mapping_information, @model = mapping_information, model
    end

    def build
      form_instance
    end

    protected

    def form_instance
      @form_instance ||= assign_model_attributes(empty_form)
    end

    def empty_form
      @mapping_information.form.new
    end

    def assign_model_attributes( form_instance )
      form_instance.assign_model( @model )
      form_instance
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form_object-0.1.1 lib/form_object/base/form_builder.rb