Hello, I'm a newbie at Rails. Let's say I have this simple form:
<%= form_for @article do |f| %>
<%= f.label :title %>
<%= f.text_field :title %>
<%= f.label :description %>
<%= f.text_area :description %>
<%= f.submit %>
<% end %>
This form works fine. But, what I would prefer to do is this:
form_for @article do |f|
See how clean the code is! Consider if this were a large form, carrying along the open and close Ruby tags (<%=) and (%>) EVERY single line would be a pain in the neck and inefficient! Now, let's say if I need to include any HTML tag (such as p or br) to render the form the way I want, is there a way to include any HTML tag OR text without leaving Ruby ? I know I can easily achieve this if I were to code in PHP. It would be a distraction to switch back and forth between Ruby and HTML, especially when working with a large form.
eelcoj, I appreciate your response! It's not about less typing, it's about keeping the code clean and compact. Thanks!
Join 31,152+ developers who get early access to new screencasts, articles, guides, updates, and more.