Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Views don't show errors #118

Open
jscheid opened this Issue · 1 comment

2 participants

@jscheid

It seems that the generated new.jst.ejs and edit.jst.ejs templates don't contain code to show any server-side errors that occurred when saving/updating the model.

The generated code reads:

<div class="field">
  <label for="name"> name:</label>
  <input type="text" name="name" id="name" value="<%= name %>" >
</div>

... when it should probably read something more like:

<div class="field">
  <label for="name"> name:</label>
  <input type="text" name="name" id="name" value="<%= name %>" >
  <% if (typeof errors != "undefined" && errors['name']) { %>
    <div class="field-error"><%= errors.name %></div>
  <% } %>
</div>
@westonplatter

@jscheid any ideas for how you'd like to have this implemented? I usually render errors in a _messages.html.erb partial file when I'm running with a Rails rendered stack.

Maybe one idea is catching errors from the Backbone.sync event fire, and then render whatever errors are generated from that. Would love to consider adding this to http://westonplatter.com/railsy_backbone.

Happy to work PRs through the system. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.