samvera/hydra-editor

Error when trying to use an object's method to supply values to multi-value input

afred opened this issue · 0 comments

afred commented
simple_form_for(foo), url: 'example.org' do |f|
  f.input :bar, as: :multi_value
end
# This will throw an error if Foo#bar exists, but bar is not an attribute on Foo.

Done when: you can create a MultiValueInput for the values from an an object's method (not just an attribute).

Our use case:

  • We have a custom input that extends MultiValueInput (similar to inputs in Hyrax).
  • We need to rearrange some of the object's terms into a different structure that is then passed to our custom input. We use an instance method to do this, but MultiValueInput currently only pays attention to attributes, not instance methods.