Skip to content

Instantly share code, notes, and snippets.

@jperrine
Created October 28, 2011 16:16
Show Gist options
  • Save jperrine/1322659 to your computer and use it in GitHub Desktop.
Save jperrine/1322659 to your computer and use it in GitHub Desktop.
ignore field name in errors
# in your model
def self.full_message_fields
[:field1, :field2] # these fields will display the full message
end
# inside your form
-if @group.errors.any?
#error_explanation
%ul
- @group.errors.each do |attr, msg|
- if @group.class.full_message_fields.include? attr
%li= "#{attr} #{msg}"
- else
%li= msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment