Method: FormObject::Base#attributes_for
- Defined in:
- lib/form_object/base.rb
#attributes_for(model) ⇒ Object
Note:
If you dont pass a model to extra attributes they will not show up here
Note:
attributes for model does not work for multiple_instance_models
Returns all of the attributes for a model
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/form_object/base.rb', line 108 def attributes_for(model) model_is_activerecord?(model) hash = ActiveSupport::HashWithIndifferentAccess.new attribute_lookup.each_with_object(hash) do |value, object| lookup = value[1] form_attribute = value[0] object[lookup[:original_method]] = attributes[form_attribute] if lookup[:model] == model.name end end |