Display field name in errors w/ config.wrapper option :prefix_attribute_name #729

wants to merge 1 commit into


None yet

2 participants

This adds the ability to prefix error messages through a config.wrapper option :prefix_attribute_name.


Can you expand a little bit more your use case for this please?

I want the "full_error" message to display on my forms like this:

The only option I see to display the full_error without this patch is to do something like this inside my form:

 <%= f.full_error :token %>

The problem with this is that the error message tag is displayed outside the controls div. Am i missing something?


It seems duplication to me to have the field name in the label and in the error message. Anyway, you can achieve it with something like this:

<%= f.input :email, error: false do %>
  <%= f.input_field :email %>
  <%= f.full_error :email %>
<% end %>

That should give you the expected output.

That's works perfectly -- thanks!

@alivesay alivesay closed this Jan 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment