app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.3.1 vs app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.3.2
- old
+ new
@@ -1,9 +1,9 @@
- value = params.dig(model_class.to_s.underscore, property.to_s)
- form_object = instance_variable_get "@#{object}_form"
- case type
- when :default
- = form.input property, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.model.send(property) || value) }, selected: (form_object.model.send(property) || value)
+ = form.input property, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }, selected: (form_object.model.send(property) || value)
- when :association
- = form.association property, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.model.send("#{property}_id") || value) }, selected: (form_object.model.send("#{property}_id") || value)#, collection: property.to_s.camelize.constantize.active
+ = form.association property, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send("#{property}_id") || value) }, selected: (form_object.model.send("#{property}_id") || value)#, collection: property.to_s.camelize.constantize.active
- else
- = form.input property, as: type, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.model.send(property) || value) }
+ = form.input property, as: type, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }