jsonapi-authorization
jsonapi-authorization copied to clipboard
Testing polymorphic has_many associations
Since jsonapi-resources
v0.9.6 it has been possible to do updates to polymorphic has_many
associations: https://github.com/cerebris/jsonapi-resources/pull/1217
We should probably have some sort of a test to verify jsonapi-authorization
works for these cases.
Would be nice if this new test case was written in a way where all the code needed for the test would be next to the test file itself, as described in https://github.com/venuu/jsonapi-authorization/pull/124#issuecomment-477892117
0.9.6 seems use {type: 'some-type', ids: [...]} as params to identify polymorphic has_many associations, which can't be simply passed to ActiveRecord's find function. This behavior breaks the polymorphic has_many association authorization.
@ouabing can you show an example scenario where there's breakage? Preferably open a new issue with that information :relaxed:
Oh sorry, finally I found that's my fault. I marked a non-polymorphic relationship as a polymorphic one (which works without problem in JA 1.0 version).
Thanks for clarifying :relaxed:. I hid the comments above as resolved as this discussion wasn't about the original issue description