Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created June 26, 2012 23:18
Show Gist options
  • Save ArunGupta25/3000065 to your computer and use it in GitHub Desktop.
Save ArunGupta25/3000065 to your computer and use it in GitHub Desktop.
Enter a message (optional) and address. If you don't have an address, enter an email and we'll email that person for their address.
<br />
<%= form_for(@postcard, :remote => true) do |f| %>
<% if @postcard.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@postcard.errors.count, "error") %> prohibited this postcard from being saved:</h2>
<ul>
<% @postcard.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :message %><br />
<%= f.text_area(:message, :size => "40x8") %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email %>
</div>
<div class="field">
<%= f.label :size %><br />
<%= f.select(:size, options_for_select([['Regular (4x6)', 'regular'], ['Jumbo (5.5x8.5)', 'jumbo']])) %>
</div>
<div class="field">
<%= f.hidden_field(:user_id, :value => current_user.id) %>
<%= f.hidden_field(:photo_id, :value => params[:photo]) %>
</div>
<%= f.fields_for :addresses do |builder| %>
<p>
<%= render 'addresses/form', :builder => builder %>
</p>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
match "/share/postcard" => "home#postcard", :as => :postcards
post "/share/postcard" => "home#postcard_create", :as => :postcards_create
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment