Skip to content

Instantly share code, notes, and snippets.

@lexmag
Created July 29, 2012 21:11
Show Gist options
  • Save lexmag/3201853 to your computer and use it in GitHub Desktop.
Save lexmag/3201853 to your computer and use it in GitHub Desktop.
DRYing Up Rails Views
<%= simple_form_for(@product) do |f| %>
<%= f.input :title %> <!-- string -->
<%= f.input :description %> <!-- text -->
<%= yield(f) if block_given? %>
<%= f.button :submit %>
<% end %>
<%= render layout: 'form' do |f| %>
<%= f.input :availability %> <!-- boolean -->
<% end %>
<%= render layout: 'form' do |f| %>
<%= f.input :part_number %> <!-- integer -->
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment