Skip to content

Instantly share code, notes, and snippets.

@Loschcode
Last active November 15, 2016 15:46
Show Gist options
  • Save Loschcode/cc48963a0ffc1bfdf4d8e09a3d9e5d1c to your computer and use it in GitHub Desktop.
Save Loschcode/cc48963a0ffc1bfdf4d8e09a3d9e5d1c to your computer and use it in GitHub Desktop.
# before
<%= form.fields_for :desc_translations do |trans_field| %>
<div class="col-md-5">
<%= trans_field.text_area :de, :value => form.object.desc_translations[:de], :class => 'form-control', :required => true %>
<div class="help-block with-errors"></div>
</div>
<div class="col-md-5">
<%= trans_field.text_area :'zh-CN', :value => form.object.desc_translations[:'zh-CN'], :class => 'form-control', :required => true %>
<div class="help-block with-errors"></div>
</div>
<% end %>
# after
<% translate form, :desc do %>
<div class="col-md-5">
<%= yield :class => 'form-control', :required => true %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment