Skip to content

Instantly share code, notes, and snippets.

@baothi
Created April 20, 2015 01:41
Show Gist options
  • Save baothi/1ae9128f1671eb8983ef to your computer and use it in GitHub Desktop.
Save baothi/1ae9128f1671eb8983ef to your computer and use it in GitHub Desktop.
<%= form_for(@product) do |f| %>
<% if @product.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
<ul>
<% @product.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :test %><br>
<%= f.text_field :test %>
</div>
cach 1 xet theo radio
<div>
<td class="center">
<% [*1..1].each do | i| %>
<% [*1..4].each do |j| %>
<%= f.radio_button "fix_#{i}".to_sym, j %> 特集 <%= j %>
<% end %>
<% end %>
</td>
</div>
cach 2 xet theo check bok
<div>
<td class="center">
<% [*1..1].each do | i| %>
<% [*1..4].each do |j| %>
<%= f.check_box "fix_#{i}".to_sym, j %> 特集 <%= j %>
<% end %>
<% end %>
</td>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment