aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/types_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Move the appropriate type tests to the Active Model suiteSean Griffin2015-09-211-105/+0
| | | | | | | | | Any tests for a type which is not overridden by Active Record, and does not test the specifics of the attributes API interacting in more complex ways have no reason to be in the Active Record suite. Doing this revealed that the implementation of the date and time types in AM was actually completely broken, and incapable of returning any value other than `nil`.
* `type_cast_from_user` -> `cast`Sean Griffin2015-02-171-46/+46
|
* `type_cast_for_database` -> `serialize`Sean Griffin2015-02-171-1/+1
|
* Remove the SQLite3 Binary subclassSean Griffin2015-02-111-10/+0
| | | | | | As far as I can tell, the original reason that this behavior was added has been sufficiently resolved elsewhere, as we no longer remove the encoding of strings coming out of the database.
* Errors raised in `type_cast_for_database` no longer raise on assignmentSean Griffin2015-01-231-0/+17
| | | | Fixes #18580.
* Change the behavior of boolean columns to be closer to Ruby's semantics.Rafael Mendonça França2015-01-041-6/+4
| | | | | | | | Before this change we had a small set of "truthy", and all others are "falsy". Now, we have a small set of "falsy" values and all others are "truthy" matching Ruby's semantics.
* Use the correct values for int max and minSean Griffin2014-10-311-47/+0
| | | | | We had accidentally gone one power of two too far. In addition, we need to handle minimum values as well as the maximum.
* Add a deprecation warning for abiguous boolean valuesSean Griffin2014-10-161-4/+6
| | | | | | | | | | | In Rails 5.0, we'd like to change the behavior of boolean columns in Rails to be closer to Ruby's semantics. Currently we have a small set of values which are "truthy", and all others are "falsy". In Rails 5.0, we will reverse this to have a small number of values which are "falsy", and all others will become "truthy". In the interim, all values which are ambiguous must emit a deprecation warning.
* Implement `==` on `Type::Value` and `Attribute`Sean Griffin2014-08-151-0/+6
| | | | | This was a small self contained piece of the refactoring that I am working on, which required these objects to be comparable.
* Fix case statement to use ::Numeric and ::StringMariano Valles2014-07-161-17/+0
|
* Change class evaluation for Rationals in cast_valueMariano Valles2014-07-161-1/+1
|
* Fix rational to decimal on type_cast_from_userMariano Valles2014-07-161-0/+10
|
* Merge pull request #15788 from sgrif/sg-mutable-stringsRafael Mendonça França2014-06-271-7/+0
|\ | | | | | | Detect in-place modifications on Strings
| * Detect in-place modifications on StringsSean Griffin2014-06-171-7/+0
| |
* | Always assume strings with non-numeric characters change numeric typesSean Griffin2014-06-241-0/+18
|/ | | | | | | | We previously only did this if the old value was zero, to make sure numericality validations run and failed if the user gave 'wibble' as the value, which would be type cast to 0. However, numericality validations will fail if there are any non-numeric characters in the string, so 5 -> '5wibble' should also be marked as changed.
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-091-69/+69
| | | | | | | | In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
* Change typecasting unit tests to test type objects directlySean Griffin2014-05-231-0/+159
| | | | | | There's no longer type casting behavior of any kind inside of `Column` for the general case. These tests can be made clearer by testing the type objects directly.
* Revert "Refactoring attributes/types" [#3348 state:open]Pratik Naik2010-01-221-32/+0
| | | | | | | | | | | | | | | | | This reverts commit f936a1f100e75082081e782e5cceb272885c2df7. Conflicts: activerecord/lib/active_record.rb activerecord/lib/active_record/base.rb Revert "Fixed: #without_typecast should only disable typecasting on the duplicated attributes" [#3387 state:open] This reverts commit 2831996483c6a045f1f38d8030256eb58d9771c3. Reason : It's not generating attribute methods properly, making object.column 5x slower.
* Refactoring attributes/types [#3348 state:resolved]Eric Chapweske2009-10-171-0/+32
Signed-off-by: Joshua Peek <josh@joshpeek.com>