提交 cab75da9 编写于 作者: S Sean Griffin

Don't rely on the column for type information in uniquness validations

The validator has access to richer type information
上级 3fd78fc5
......@@ -59,7 +59,8 @@ def build_relation(klass, table, attribute, value) #:nodoc:
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册