Skip to content

Collection can't handle array of text fields #56

Description

@kmotsov

Having a serialized array attribute in a model

model Sample
  serialize :links, Array, prepopulate: -> (*) { self.links = links + Array.new(3 - self.links.size, '') }
end

and a reform object

class SampleForm < Reform::Form
  collection :links
end

In order to allow changing links my form is expected to render 3 inputs with name attributes links[].
However it is not possible to be achieved using formulars' collection method.

When I tried creating a slim view:

= vertical_form(model.contract, url) do |f|
  = f.collection :links
  = f.submit content: "Submit!"

It fails rendering with undefined method 'errors' for "":String

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions