Skip to content

Instantly share code, notes, and snippets.

@KellyMahan
Created September 1, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KellyMahan/1186989 to your computer and use it in GitHub Desktop.
Save KellyMahan/1186989 to your computer and use it in GitHub Desktop.
<%= form_for @timesheet do |f| %>
<% if @timesheet.errors.any? %>
<div class="error_messages">
<h2>Form is invalid</h2>
<ul>
<% for message in @timesheet.errors.full_messages %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.hidden_field :user_id, :value => current_user.id %>
<%= f.hidden_field :start_date, :value => @date %>
<table style="width: 30%">
<tr>
<th style="text-align: left">Date</th>
<th style="text-align: left; width: 10%">Hours</th>
</tr>
<tbody>
<%= f.fields_for :workdays, @timesheet.workdays do |g| %>
<td><%= g.collection_select :entry_date, week_array(@date), :to_date, :to_s, :prompt => true %></td>
<td><%= g.text_field :hours %></td>
<% end %>
</tbody>
</table>
<hr/>
<p><%= f.submit "Submit" %></p>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment