mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't rely on the column for type information in uniquness validations
The validator has access to richer type information
This commit is contained in:
parent
3fd78fc569
commit
cab75da939
1 changed files with 2 additions and 1 deletions
|
@ -59,7 +59,8 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
column = klass.columns_hash[attribute_name]
|
||||
value = klass.connection.type_cast(value, column)
|
||||
value = klass.type_for_attribute(attribute_name).type_cast_for_database(value)
|
||||
value = klass.connection.type_cast(value)
|
||||
if value.is_a?(String) && column.limit
|
||||
value = value.to_s[0, column.limit]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue