formular
formular copied to clipboard
When using Formular outside any template environment, it renders collection twice
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:
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