Skip to content

Instantly share code, notes, and snippets.

@nickyp
Created February 14, 2011 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickyp/826228 to your computer and use it in GitHub Desktop.
Save nickyp/826228 to your computer and use it in GitHub Desktop.
rescue_record_invalid
def rescue_record_invalid(e)
logger.info(e)
message = e.record.errors.map {|error|
"#{t('activerecord.attributes.' + error[0])} #{error[1]}"
}.join("\n")
respond_to do |format|
format.xml {
render :status => :unprocessable_entity,
:text => format_xml_exception(e, message)
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment