diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-05-29 06:55:44 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-05-29 07:13:53 -0700 |
commit | 8eb536e7b487351d7485879d436e9d747520ed90 (patch) | |
tree | 0e9bbf31ebd8aa0e11a64d826bdc275291275010 /activerecord/test/cases/custom_properties_test.rb | |
parent | 29f8eae3faf96cbe46e7eb949c7f674c5860c1cf (diff) | |
download | rails-8eb536e7b487351d7485879d436e9d747520ed90.tar.gz rails-8eb536e7b487351d7485879d436e9d747520ed90.tar.bz2 rails-8eb536e7b487351d7485879d436e9d747520ed90.zip |
Result sets never override a model's column type
MySQL and PostgreSQL provide a column type override in order to properly
type cast computed columns included in a result set. This should never
override the known types of full fledged columns. In addition to messing
up computed properties, this would have led to inconsistent behavior
between a record created with `new`, and a record created with `last` on
the mysql adapter in the following cases:
- `tinyint(1)` with `emulate_booleans` set to `false`
- `text`, `string`, `binary`, and `decimal` columns
Diffstat (limited to 'activerecord/test/cases/custom_properties_test.rb')
-rw-r--r-- | activerecord/test/cases/custom_properties_test.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/cases/custom_properties_test.rb b/activerecord/test/cases/custom_properties_test.rb index 397a8e0692..047c1b9b74 100644 --- a/activerecord/test/cases/custom_properties_test.rb +++ b/activerecord/test/cases/custom_properties_test.rb @@ -37,7 +37,9 @@ module ActiveRecord data.reload assert_equal 2, data.overloaded_float + assert_kind_of Fixnum, OverloadedType.last.overloaded_float assert_equal 2.0, UnoverloadedType.last.overloaded_float + assert_kind_of Float, UnoverloadedType.last.overloaded_float end def test_properties_assigned_in_constructor |