Rails: cleaner partials in forms

Damian pointed me to the patch ELC Technologies committed to Rails.

As he mentions previously you did something like

<% form_for(@client) do |f| %>
    <%= render :partial => 'form', :locals => {:f => f} %>
    <%= submit_tag 'Create' %>
<% end %>

but now you can just do…

<% form_for(@client) do |f| %>
    <%= render :partial => f %>
    <%= submit_tag 'Create' %>
<% end %>

Cleaner and more intuitive, nice!

This entry was posted in Ruby, Ruby on Rails. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word