mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
Extracts custom field values validation from CustomValue so that they can be validated globally from the customized object (#1189).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8717 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -16,36 +16,6 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
module ActiveRecord
|
||||
class Errors
|
||||
def full_messages(options = {})
|
||||
full_messages = []
|
||||
|
||||
@errors.each_key do |attr|
|
||||
@errors[attr].each do |message|
|
||||
next unless message
|
||||
|
||||
if attr == "base"
|
||||
full_messages << message
|
||||
elsif attr == "custom_values"
|
||||
# Replace the generic "custom values is invalid"
|
||||
# with the errors on custom values
|
||||
@base.custom_values.each do |value|
|
||||
value.errors.each do |attr, msg|
|
||||
full_messages << value.custom_field.name + ' ' + msg
|
||||
end
|
||||
end
|
||||
else
|
||||
attr_name = @base.class.human_attribute_name(attr)
|
||||
full_messages << attr_name + ' ' + message.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
full_messages
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ActionView
|
||||
module Helpers
|
||||
module DateHelper
|
||||
|
||||
Reference in New Issue
Block a user