-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support has_one to be compatible with 0.8.x #725
Conversation
b8108ae
to
ccc46b3
Compare
Sorry, wrong button. |
@ggordon would you mind updating the description with your reasoning behind this? |
@joshsmith done. |
Is the |
I only added tests for has_one, I didn't delete anything. |
@@ -44,7 +44,7 @@ def test_has_many | |||
assert_equal( | |||
{ posts: { type: :has_many, options: { embed: :ids } }, | |||
roles: { type: :has_many, options: { embed: :ids } }, | |||
bio: { type: :belongs_to, options: {} } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I misunderstanding, or is this not removing the the test for the belongs_to
?
ccc46b3
to
b77de96
Compare
Sorry it's been a while since I looked at this... That change is in the 'test_has_many' method so it should be irrelevant. The test 'test_belongs_to' is testing the belongs_to association on the comment serializer, which hasn't changed. |
You don't think this belongs in a |
I could add a test to associations_test.rb, I guess I was only focused on jsonapi so I put it in adapter/json_api/has_one_test.rb |
Sure, whatever you think is best. Appreciate the backwards compatibility on this, though! 💌 |
b77de96
to
370d430
Compare
Didn't see any easy way to separate the has_many and has_one tests, so i renamed it to test_has_many_and_has_one. |
Awesome, that makes sense to me. |
@ggordon could you update the README.md and CHANGELOG.md? |
Update README and CHANGELOG
README.md and CHANGELOG.md updated. Also I was sometimes getting a failure in unrelated code, I think it was an id collision in the Post model ids and the order the tests were executed. I had to make a workaround to get the tests to consistently pass. |
Support has_one to be compatible with 0.8.x
per rails-api#822 since it was readded in rails-api#725
per rails-api#822 since it was readded in rails-api#725
The 0.8.x branch used
has_one
for associations, it looks like this was changed tobelongs_to
in 0.10.x. This patch adds support forhas_one
in addition tobelongs_to
for backwards compatibility.