-
-
Save jgaskins/2211381 to your computer and use it in GitHub Desktop.
<%= form_for @article do |f| %> | |
<div class="field"> | |
<%= f.label :title %> | |
<%= f.text_field :title %> | |
</div> | |
<div class="field"> | |
<%= f.label :body %> | |
<%= f.text_area :body %> | |
</div> | |
<% end %> |
<%= form_for @article do |f| %> | |
<%= f.field :title %> | |
<%= f.field :body %> | |
<% end %> |
This was just an example. I've used SimpleForm; it's an awesome gem and it inspired this entire line of thinking for me. There are several view helpers in Rails where we may be able to remove the "one HTML tag per helper method" abstraction, not necessarily just in forms (I mentioned form helpers because that's what @solnic was referring to).
I like that we can have that level of granularity because there are always going to be times it will be helpful or even necessary, but when you're writing the same boilerplate markup in so many different views, it becomes cumbersome. When you end up loading the same gems and including the same helpers in every app you write, then the loading of those gems and inclusion of those helpers becomes boilerplate, as well — at least in my mind. :-)
This is how SimpleForm works now.