Skip to content

Instantly share code, notes, and snippets.

@etdebruin
Created May 29, 2013 15:57
Show Gist options
  • Save etdebruin/5671416 to your computer and use it in GitHub Desktop.
Save etdebruin/5671416 to your computer and use it in GitHub Desktop.
employment
<%= form_for(@employment, :html => {:id => "user-form", :class => "user-form"}) do |f| %>
<% if @employment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@employment.errors.count, "error") %> prohibited this employment from being saved:</h2>
<ul>
<% @employment.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.select :position, options_for_select(Employment::POSITION), :prompt => "Job Title" %>
</p>
<p><%= f.date_select :start %></p>
<p><%= f.date_select :stop %></p>
<p><%= f.check_box :present %> Present</p>
<p><%= f.text_area :description, :placeholder => "Describe your roles and responsibilities" %>
<div class="actions">
<%= f.hidden_field :company_id, :value => params[:company_id] %>
<%= f.submit %>
</div>
<% end %>
@etdebruin
Copy link
Author

Check box snippet produces:

 <p><input name="employment[present]" type="hidden" value="0" /><input id="employment_present" name="employment[present]" type="checkbox" value="1" /> Present</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment