Commit Graph

15 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
Ryuta Kamizono faca40dfd4 ✂️
[ci skip]
2017-04-13 07:15:04 +09:00
Kir Shatrov 1c1aba7758 Indicate action that failed in YamlColumn 2017-02-05 11:54:40 -05:00
Kir Shatrov 99820fbeb2 Report the attribute on ActiveRecord::SerializationTypeMismatch 2017-01-29 17:24:44 -05:00
Xavier Noria 9617db2078 applies new string literal convention in activerecord/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:26:53 +02:00
Johannes Opper 894facb196 Fix bug in JSON deserialization when column default is an empty string
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.
2016-02-22 17:59:51 +01:00
Mike Mangino 1bf6b53aa4 Remove all error masking when decoding serialized data fails? 2013-04-02 11:45:14 -04:00
Mike Mangino a4743960a0 Raise an exception when unserialization fails due to a missing class 2013-03-28 11:19:01 -04:00
Guten 9637de6b47 ActiveRecord::Coders::YAMLColumn#dump should raise an error
closes #2737

Conflicts:

	activerecord/lib/active_record/coders/yaml_column.rb
2012-03-26 21:57:39 +02:00
Aaron Patterson 61774e0d49 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
Jon Leighton 253bb6b926 Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. 2011-06-04 23:47:03 +01:00
Guillermo Álvarez 351331fb34 Make serialized columns with explicit object_type return a new instance of the object instead of nil 2011-02-03 09:08:45 -08:00
Aaron Patterson 3cc2b77dc1 adding a YAML Column coder for YAML serialization to db columns 2011-02-01 14:25:46 -08:00