Goal: rake default task can do everything without manual setup
Also delete `spec/dummy_app/db/schema.rb`. People forget (understandably)
to update it. As long as we don't use the db:setup task first,
we don't need it.
This PR addresses #1015
Starting from Rails version 5.0.2 the default serializer of PostgreSQL columns returns an ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array object instead of a string. This new object is not suitable for JSON encoding and breaks versioning of any array fields backed by Postgres.
Whenever a PostgreSQL array is used, instead of asking Active Record for a serializer we introduce our own, which simply returns the underlying array without any modifications.
```
ActiveRecord::StatementInvalid: SQLite3::SQLException:
object name reserved for internal use:
sqlite_autoindex_custom_primary_key_records_1:
CREATE UNIQUE INDEX "sqlite_autoindex_custom_primary_key_records_1"
ON "custom_primary_key_records" ("uuid")
```
When a record is inserted into the `versions` table, it is given an `item_type` like `Foo::Bar`, but the association reification queries were searching for an `item_type` like `::Foo::Bar`.
Since Rails 5.0, belongs_to_required_by_default has been the official ActiveRecord default.
Add the configuration lines necessary to enable this default in both 5.0 and 5.1.
Add "optional: true" where necessary to fix spec failures caused by this change.
Add version-checking conditionals where necessary.
Update the Changelog appropriately.
model_spec is far too long, let's break it up into specs for individual
models in the dummy app.
Extract spec/models/legacy_widget_spec.rb
Extract spec/models/on/empty_array_spec.rb
Extract spec/models/on/create_spec.rb
Extract spec/models/on/update_spec.rb
Extract spec/models/on/destroy_spec.rb
Move an example to config_spec.rb
Extract spec/models/translation_spec.rb
Extract spec/models/article_spec.rb
Move examples to document_spec.rb
- Convert serializers/mixin_json_test.rb to rspec
- Convert functional/thread_safety_test.rb to rspec
- Convert functional/controller_test.rb to rspec
- Move the dummy app from test to spec, delete test dir