Skip to content

Instantly share code, notes, and snippets.

@fjfish
Created July 15, 2013 17:51
Show Gist options
  • Save fjfish/6001949 to your computer and use it in GitHub Desktop.
Save fjfish/6001949 to your computer and use it in GitHub Desktop.
Put your list of form fields in, load the file in irb, and out pops the html ready to be edited without you having to do a lot of repetitive typing
def make_group col
<<-EOT
<div class="control-group">
<%= form.label :#{col}, class: 'control-label' %>
<div class="controls">
<%= form.text_field :#{col}, { class: 'input-xlarge' } %>
</div>
</div>
EOT
end
[
:title,
:first_name,
:last_name,
:address1,
:address2,
:address3,
:town,
:postcode,
:email
].each do |col|
puts make_group col
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment