aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/helpers/numeric.rb
Commit message (Collapse)AuthorAgeFilesLines
* Don't allow `where` with non numeric string matches to 0 valuesRyuta Kamizono2019-02-201-2/+5
| | | | | | | | | | | | This is a follow-up of #35310. Currently `Topic.find_by(id: "not-a-number")` matches to a `id = 0` record. That is considered as silently leaking information. If non numeric string is given to find by an integer column, it should not be matched to any record. Related #12793.
* Extract duplicated `serialize` methods into helpersRyuta Kamizono2019-02-181-0/+4
| | | | | | | | Since `serialize` is passed user input args (from `where`, schema default, etc), a helper should provide `serialize` if the helper also provide `cast`. Related #32624, 34cc301, a741208.
* Fix non_numeric_string?Yoshiyuki Kinjo2018-09-071-1/+1
| | | | | | | | | | | | | | | | For example, dirty checking was not right for the following case: ``` model.int_column = "+5" model.float_column = "0.5E+1" model.decimal_column = "0.5e-3" ``` It is enough to see whether leading character is a digit for avoiding invalid numeric expression like 'wibble' to be type-casted to 0, as this method's comment says. Fixes #33801
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-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
|
* Change ActiveModel::Type::Helpers to :nodoc: [ci skip]MSP-Greg2016-12-161-2/+2
|
* apply case-in-assignment patternXavier Noria2016-09-021-6/+7
|
* RuboCop is 100% green :tada:Xavier Noria2016-09-021-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-9/+9
|
* Move ActiveRecord::Type to ActiveModelKir Shatrov2015-09-211-0/+34
The first step of bringing typecasting to ActiveModel