Skip to content

Instantly share code, notes, and snippets.

@brentvatne
Created April 2, 2011 02:25
Show Gist options
  • Save brentvatne/899181 to your computer and use it in GitHub Desktop.
Save brentvatne/899181 to your computer and use it in GitHub Desktop.
# edit
<h1>Edit user</h1>
<%= form_for(@user) do |f| %>
<%= render :partial => "shared/error_messages", :locals => { :object => f.object } %>
<%= render 'fields', :f => f %>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<div>
<%= gravatar_for @user %>
<a href="http://gravatar.com/emails" target="new">change</a>
</div>
#shared/error_messages
<% if object.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(object.errors.count, "error") %>
prohibited this <%= object.class.to_s %> from being saved:
</h2>
<p>There were problems with the following fields:</p>
<ul>
<% object.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</div>
<% end %>
Showing /Users/brentvatne/rails_projects/sample_app/app/views/shared/_error_messages.html.erb where line #1 raised:
undefined local variable or method `object' for #<#<Class:0x000001012c2638>:0x000001012bf668>
Extracted source (around line #1):
1: <% if object.errors.any? %>
2: <div id="error_explanation">
3: <h2>
4: <%= pluralize(object.errors.count, "error") %>
##### from stack trace
app/views/shared/_error_messages.html.erb:1:in `_app_views_shared__error_messages_html_erb__3866027758567222401_2155351040_2812652737701224448'
actionpack (3.0.5) lib/action_view/template.rb:135:in `block in render'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment