lib/compony/model_fields/anchormodel.rb in compony-0.0.2 vs lib/compony/model_fields/anchormodel.rb in compony-0.0.3
- old
+ new
@@ -5,10 +5,10 @@
def self.collect(flat_array, label_method: :label, key_method: :key)
return flat_array.map { |entry| [entry.send(label_method), entry.send(key_method)] }
end
def value_for(data, controller: nil, **_)
- return transform_and_join(data.send(@name), controller:, &:label)
+ return transform_and_join(data.send(@name), controller:) { |el| el&.label }
end
def simpleform_input(form, _component, **input_opts)
selected_cst = form.object.send(@name)
anchormodel_attribute = @model_class.anchormodel_attributes[@name]