rails/activerecord/test
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
..
active_record/connection_adapters introduce conn.data_source_exists? and conn.data_sources. 2015-09-22 19:48:44 +02:00
assets
cases Fix bug in JSON deserialization when column default is an empty string 2016-02-22 17:59:51 +01:00
fixtures Fixed where for polymorphic associations when passed an array containing different types. 2016-02-16 10:41:26 -08:00
migrations Internal test migrations use the private 'Current' version 2015-12-15 17:18:09 +10:30
models Fixed where for polymorphic associations when passed an array containing different types. 2016-02-16 10:41:26 -08:00
schema eliminate warnings about multiple primary keys on habtm join tables 2016-02-19 15:31:56 -08:00
support Deprecate #table_exists?, #tables and passing arguments to #talbes 2015-11-09 23:13:23 +09:00
.gitignore
config.example.yml Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
config.rb