diff options
| author | Ryuta Kamizono <kamipo@gmail.com> | 2016-08-14 06:17:20 +0900 | 
|---|---|---|
| committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-08-19 12:11:26 +0900 | 
| commit | 99cb16a2babfb10b8c2bc3270a38fcb3ca92bb09 (patch) | |
| tree | b7132e8de07a5bafbb5fd432fb38047408fd8b05 /activemodel/lib | |
| parent | 28aaf77bb07af5e0108ff986e192e71da6d25078 (diff) | |
| download | rails-99cb16a2babfb10b8c2bc3270a38fcb3ca92bb09.tar.gz rails-99cb16a2babfb10b8c2bc3270a38fcb3ca92bb09.tar.bz2 rails-99cb16a2babfb10b8c2bc3270a38fcb3ca92bb09.zip | |
Remove text default treated as an empty string in non-strict mode
Strict mode controls how MySQL handles invalid or missing values in
data-change statements such as INSERT or UPDATE. If strict mode is not
in effect, MySQL inserts adjusted values for invalid or missing values
and produces warnings.
```ruby
  def test_mysql_not_null_defaults_non_strict
    using_strict(false) do
      with_mysql_not_null_table do |klass|
        record = klass.new
        assert_nil record.non_null_integer
        assert_nil record.non_null_string
        assert_nil record.non_null_text
        assert_nil record.non_null_blob
        record.save!
        record.reload
        assert_equal 0,  record.non_null_integer
        assert_equal "", record.non_null_string
        assert_equal "", record.non_null_text
        assert_equal "", record.non_null_blob
      end
    end
  end
```
It is inconsistent with other types that only text/blob defaults treated
as an empty string. This commit fixes the inconsistency.
Diffstat (limited to 'activemodel/lib')
0 files changed, 0 insertions, 0 deletions
