Skip to content

Instantly share code, notes, and snippets.

@meltzerj
Created March 30, 2011 21:45
Show Gist options
  • Save meltzerj/895380 to your computer and use it in GitHub Desktop.
Save meltzerj/895380 to your computer and use it in GitHub Desktop.
Edit view
<%= form_for(:profile, @profile, :url => {:controller => "profiles", :action => "update"}, :html => { :multipart => true, :method => :put }) do |f| %>
<% if @user.errors.any? %>
<div id="errorExplanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.fields_for :user do |t| %>
<div class="field">
<%= t.label :name, "Full Name" %><br />
<%= t.text_field :name %>
</div>
<% end %>
<div class="field">
<%= f.label :bio, "Biography" %><br />
<%= f.text_area :bio %>
</div>
<%= f.fields_for :genre do |g| %>
<div class="field">
<%= g.label :name, "Genres" %><br />
<%= g.text_field :name, :id => 'genre_field' %>
</div>
<% end %>
<div class="field">
<%= f.label :photo, "Upload Profile Picture" %>
<%= f.file_field :photo %><br />
</div>
<div class="action">
<%= f.submit :profile, :value => "Update Profile" %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment