Skip to content

Instantly share code, notes, and snippets.

@lucasrenan
Created September 8, 2012 19:02
Show Gist options
  • Save lucasrenan/3678692 to your computer and use it in GitHub Desktop.
Save lucasrenan/3678692 to your computer and use it in GitHub Desktop.
form rails girls
<%= form_for(@post, :html => {:multipart => true}) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :cause %><br />
<%= f.text_field :cause %>
</div>
<p>
<label>Photo</label>
<%= f.file_field :photo %>
<%= f.hidden_field :photo_cache %>
</p>
<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