summaryrefslogtreecommitdiff
path: root/app/views/tournaments/_selected.html.erb
blob: 4277d8ea5432d20d49a874981280d7cf6662b96c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<%= form_for(@tournament) do |f| %>
  <% if @tournament.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:</h2>

      <ul>
      <% @tournament.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <%# this is the dynamic script to output fields to the form %>
  <% @chosen = Game.find(@game) %>
  <% @chosen.attributes.each do |name, value| %>
    <% if name == "id" %>
      <% next %>
    <% end %>
    <% if name == "created_at" %>
      <% break %>
    <% end %>
  <p>
    <label for=<%= name %>><%= name.capitalize.gsub('_', ' ') %></label>
    <br />
    <input type="text" id=<%= name %> value=<%= value %>>
  </p>
  <% end %>

  <%= f.submit %>
<% end %>