formular icon indicating copy to clipboard operation
formular copied to clipboard

When using Formular outside any template environment, it renders collection twice

Open blelump opened this issue 8 years ago • 1 comments

Consider such example:

class CustomBuilder < Formular::Builders::Bootstrap3
end

model = OpenStruct.new(ble: "blargh", coll: [OpenStruct.new(name: 1, id: 3), OpenStruct.new(name: 2, id: 5)])

f = CustomBuilder.new(model: model, path_prefix: "blah" ).form(method: :post, action: "/ok") do |f|
  concat f.input :ble
  f.collection :coll do |g|
    concat g.input :name
    concat g.input :id
  end
end

The result is: img

blelump avatar Jul 18 '16 14:07 blelump

Thanks for reporting, I've added a failing test to this branch and have got a fix for use without template engines, but it breaks ERB... So still a work in progress here I'm afraid!

https://github.com/trailblazer/formular/blob/fix-collection-buffer/lib/formular/builder.rb#L48-L49

fran-worley avatar Jul 20 '16 06:07 fran-worley