1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Rename the method to match what it is doing

This commit is contained in:
Rafael Mendonça França 2020-12-09 17:10:22 +00:00
parent 72dc9ac8e3
commit b24ed15baa
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 3 additions and 3 deletions

View file

@ -108,7 +108,7 @@ module ActiveModel
end end
end end
def read_attribute_for_validation(record, attr_name, value) def prepare_value_for_validation(value, record, attr_name)
return value if record_attribute_changed_in_place?(record, attr_name) return value if record_attribute_changed_in_place?(record, attr_name)
came_from_user = :"#{attr_name}_came_from_user?" came_from_user = :"#{attr_name}_came_from_user?"

View file

@ -149,7 +149,7 @@ module ActiveModel
attributes.each do |attribute| attributes.each do |attribute|
value = record.read_attribute_for_validation(attribute) value = record.read_attribute_for_validation(attribute)
next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank]) next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])
value = read_attribute_for_validation(record, attribute, value) value = prepare_value_for_validation(value, record, attribute)
validate_each(record, attribute, value) validate_each(record, attribute, value)
end end
end end
@ -167,7 +167,7 @@ module ActiveModel
end end
private private
def read_attribute_for_validation(record, attr_name, value) def prepare_value_for_validation(value, record, attr_name)
value value
end end
end end