Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Helper pour modifier un field de form quand il y a un erreur
<% field_with_errors @zonage, :name do %>
<div class="control-group">
<%= f.label 'Nom du zonage', :class => 'control-label' %>
<div class="controls">
<%= f.text_field :name %>
<% end %>
# modified for replacer a class
def field_with_errors(object, method, &block)
if block_given?
if object.errors[method].empty?
concat capture(&block)
add_error = capture(&block).gsub("control-group", "control-group error")
concat raw(add_error)
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.