You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#1479
Rails 8.1 changed `ActionDispatch::Routing::Mapper::Resources::Resource#initialize`
to require keyword args (only:, except:, **options). The JSONAPI‑Resources
DSL still passes a positional options hash, so jsonapi_relationships never
runs and relationship routes are missing.
Adding the ** operator to `**options` converts the hash into keyword args.
Tests that fail without this change: `test/controllers/controller_test.rb`
I ran into several other deprecations.
* `ActiveSupport::Deprecation.silenced`
will not work the way it was set up in the tests because `#silenced` now
works on an instance of `Deprecators` instead of globally. I created a
module `JSONAPI.deprecator` so that the gem can use its own instance
of Deprecator and the tests can work as designed.
* `:unprocessable_entity` was deprecated in favor of `:unprocessable_content`
* Used lazy method evaluation for `Configuration` because Rails 8.1 does
not guarantee class-body initialization order, so @configuration was returning
`nil`.
* My team uses an active_record oracle adapter. Oracle unquoted identifiers
are automatically stored as UPPERCASE. Rails 8.1 no longer normalizes
the case automatically for queries, so I added a condition for using the
oracle adapter.
* `length` is no longer a valid column constraint. Used `limit` instead
* `references:` is not a valid option key for ActiveRecord migrations.
Excplicitly pass a foreign_key to the things table instead.
* `:none` is not a valid active_record schema format in Rails 8.1
* Disabled foreign key constraints for SQLite tests
* Use `ActiveRecord::Base.connection.quoted_true` as it is database agnostic
There are a few warnings in the test suite that I did not address because
they were unrelated to this change.
0 commit comments