aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/coders
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-192-0/+4
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-022-2/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-012-0/+2
|
* Indicate action that failed in YamlColumnKir Shatrov2017-02-051-4/+4
|
* Report the attribute on ActiveRecord::SerializationTypeMismatchKir Shatrov2017-01-291-2/+3
|
* beginrescueendAkira Matsuda2017-01-121-5/+3
|
* let Regexp#match? be globally availableXavier Noria2016-10-271-1/+0
| | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-6/+6
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* adds missing requiresXavier Noria2016-07-241-0/+1
|
* systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Fix bug in JSON deserialization when column default is an empty stringJohannes Opper2016-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | When `ActiveRecord::Coders::JSON` serialization is used and the default of the column returns `''` it raises the following error: ``` JSON::ParserError: A JSON text must at least contain two octets! ``` If MySQL is running in non-strict mode, it returns an empty string as column default for a text column: ```ruby def extract_default if blob_or_text_column? @default = null || strict ? nil : '' end end ``` Since `''` is invalid JSON, there shouldn't be an attempt to parse it, it should be treated like nil. ActiveRecord::Coders::JSON should behave consistently for all possible non-user-set column default values.
* Clean up the implementation of AR::DirtySean Griffin2015-09-241-8/+9
| | | | | | | | | | | | | This moves a bit more of the logic required for dirty checking into the attribute objects. I had hoped to remove the `with_value_from_database` stuff, but unfortunately just calling `dup` on the attribute objects isn't enough, since the values might contain deeply nested data structures. I think this can be cleaned up further. This makes most dirty checking become lazy, and reduces the number of object allocations and amount of CPU time when assigning a value. This opens the door (but doesn't quite finish) to improving the performance of writes to a place comparable to 4.1
* Provide a better error message for unsupported classes in `serialize`Sean Griffin2014-12-271-0/+11
| | | | | | | | | We only support classes which provide a no-args constructor to use as a default value. We can provide a more helpful error message if we catch this when `serialize` is called, rather than letting it error when you try to assign the attribute. Fixes #18224
* Merge pull request #16162 from chancancode/fix_json_coderGodfrey Chan2014-07-151-1/+1
| | | | Fixed JSON coder when loading NULL from DB
* Revert "Revert "Merge pull request #16059 from jenncoop/json-serialized-attr""Godfrey Chan2014-07-151-0/+13
| | | | | | | This reverts commit 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f. Conflicts: activerecord/CHANGELOG.md
* Revert "Merge pull request #16059 from jenncoop/json-serialized-attr"Godfrey Chan2014-07-051-13/+0
| | | | | | This reverts commit a03097759bd7103bb9db253e7ba095f011453f75. This needs more work before it would work correctly on master.
* Merge pull request #16059 from jenncoop/json-serialized-attrGodfrey Chan2014-07-051-0/+13
| | | | | | | | Fixed issue with ActiveRecord serialize object as JSON Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/serialization.rb
* Remove all error masking when decoding serialized data fails?Mike Mangino2013-04-021-13/+8
|
* Raise an exception when unserialization fails due to a missing classMike Mangino2013-03-281-1/+2
|
* drop errors constantVipul A M2013-03-271-2/+1
|
* fix AR::Coders::YAMLColumn nodoc [ci skip]Francesco Rodriguez2012-09-211-4/+2
|
* Psych is always available on 1.9Jeremy Kemper2012-05-311-5/+3
|
* ActiveRecord::Coders::YAMLColumn#dump should raise an errorGuten2012-03-261-1/+7
| | | | | | | | closes #2737 Conflicts: activerecord/lib/active_record/coders/yaml_column.rb
* Do not serialize nil in serialized attribute.Kirill Lashuk2012-01-311-1/+1
|
* Make serialized columns with explicit object_type return a new instance of ↵Guillermo Álvarez2011-02-031-0/+2
| | | | the object instead of nil
* move the coders to the serialized_attributes hashAaron Patterson2011-02-011-1/+6
|
* adding a YAML Column coder for YAML serialization to db columnsAaron Patterson2011-02-011-0/+34