Commit Graph

9 Commits

Author SHA1 Message Date
Kir Shatrov 831be98f9a Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Iain Beeston 994ce87bbd Moved database-specific ActiveModel types into ActiveRecord
ie. DecimalWithoutScale, Text and UnsignedInteger
2016-10-14 20:21:20 +01:00
Sean Griffin 858a7b0429 Move the appropriate type tests to the Active Model suite
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`.
2015-09-21 10:12:31 -06:00
Sean Griffin 1455c4c22f `type_cast_for_database` -> `serialize` 2015-02-17 13:35:23 -07:00
Sean Griffin 7c6f3938de Move integer range validation to never raise on assignment
Given that this was originally added to normalize an error that would
have otherwise come from the database (inconsistently), it's more
natural for us to raise in `type_cast_for_database`, rather than
`type_cast_from_user`. This way, things like numericality validators can
handle it instead if the user chooses to do so. It also fixes an issue
where assigning an out of range value would make it impossible to assign
a new value later.

This fixes several vague issues, none of which were ever directly
reported, so I have no issue number to give. Places it was mentioned
which I can remember:

- 9ba21381d7/lib/shoulda/matchers/active_model/allow_value_matcher.rb (L261-L263)
- https://github.com/rails/rails/issues/18653#issuecomment-71197026
2015-01-23 14:30:23 -07:00
Ryuta Kamizono 7da314bb03 Remove unused line 2014-12-17 19:38:32 +09:00
Ryuta Kamizono b61a93b44e Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger. 2014-12-12 00:35:48 +09:00