Added mysql error regex to get human error message.
This commit is contained in:
parent
2820639c42
commit
8f8bfb60b8
1 changed files with 3 additions and 0 deletions
|
@ -546,6 +546,9 @@ class ApplicationController < ActionController::Base
|
|||
if error =~ /null value in column "(.+?)" violates not-null constraint/i
|
||||
data[:error_human] = "Attribute '#{$1}' required!"
|
||||
end
|
||||
if error =~ /Field '(.+?)' doesn't have a default value/i
|
||||
data[:error_human] = "Attribute '#{$1}' required!"
|
||||
end
|
||||
|
||||
if Rails.env.production? && !data[:error_human].empty?
|
||||
data[:error] = data[:error_human]
|
||||
|
|
Loading…
Reference in a new issue