I was going to ruse some of my code from one of the 1.3 apps and in my 2.3 app and the form block style is apparently not supported anymore. This, for example returns undefined method div:
This looks a lot like Phlex. While there isnāt an official way to integrate Phlex with Hanami views at the moment, few people (including me) were interested in this. So I think we will get there eventually.
Yes, it was Hanami::Helpers if Iām not mistaken, but it has been discontinued. However, looking at new Hanami::View, I found TagHelper, so perhaps this would work?
<%= form_for :company, "/companies/#{company.id}", method: :patch, id: "xtube-companies-edit", values: {company: company} do |f| %>
<%= tag.div class: "my-top-class" do %>
<%= f.label "Name", for: :name %>
<%= f.text_field :name, class: "xtube-form-input" %>
<% end %>
<%= tag.div class: "my-top-class" do %>
<%= f.submit "Update", class: "xtube-form-button-submit" %>
<% end %>
<% end %>
The old Hanami 1 approach of āeverything in a single blockā was taken because of limitations in the ERB rendering at the time. There was no way to capture literal template strings inside Ruby blocks, like this:
<%= form_for :company, "..." %>
<h1>This is my cool form</h1>
<% end %>
But with Hanami 2, now you can! So this is why weāve adopted this more conventional approach to our form helpers.
This also means you can replace your tag.div helper calls with literal <div> elements, if you prefer.
I see the difference. Given the change Iām probably just go with the <div> syntax.
If I may, Iād repeat the question here, since it seems related, but Iām not sure if itās about the parser or anything else. I have the select like this: