Module: Reform::Form::ActiveModel::FormBuilderMethods

Defined in:
lib/reform/form/active_model/form_builder_methods.rb

Overview

Including FormBuilderMethods will allow using form instances with form_for, simple_form, etc. in Rails. It will further try to translate Rails’ suboptimal songs_attributes weirdness back to normal ‘songs: ` naming in #valiate.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/reform/form/active_model/form_builder_methods.rb', line 6

def self.included(base)
  base.extend ClassMethods # ::model_name
end

Instance Method Details

#deserialize!(params) ⇒ Object

Modify the incoming Rails params hash to be representable compliant.



27
28
29
30
31
32
33
34
# File 'lib/reform/form/active_model/form_builder_methods.rb', line 27

def deserialize!(params)
  # this only happens in a Hash environment. other engines have to overwrite this method.
  schema.each do |dfn|
    rename_nested_param_for!(params, dfn)
  end

  super(params)
end