-
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
Fix #as_json
glitch caused by JSON and Rails
#1318
Conversation
@@ -338,7 +338,7 @@ def to_json(*args) | |||
# object including the root. | |||
def as_json(options={}) | |||
options ||= {} | |||
if root = options.fetch(:root, @options.fetch(:root, root_name)) | |||
if root = options.to_hash.fetch(:root, @options.fetch(:root, root_name)) |
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.
failing test?
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.
I'll check it out tomorrow.
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.
Interesting, these tests are already failing on 0.8.3 prior to this change.
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.
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.
It looks like the 0-8-stable branch has been failing since 2013, looks like this PR broke it: #477
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.
@bf4 I fixed some of your gem's tests, so this is now in a better state than the current 0-8-stable branch. It's not passing on some older versions of ruby that you guys are testing on travis because:
mime-types requires Ruby version >= 1.9.2
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.
@mhuggins s/my/our gem. Thanks for looking into this. Sorry for being slow here...
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.
No problem, hopefully this is helpful and looks good. :)
Somebody familiar with the 0.8 codebase to review this? cc @joaomdmoura |
Just thought I'd follow up to see if there's anything else I can offer here. |
Considering ruby 1.8.7 has been EOLed a few years ago, and considering changes necessitating ruby >= 1.9.3 have been committed to the 0.8 branch, I believe we can safely remove support for ruby < 1.9.3, and merge this commit. |
Also, thanks a lot @mhuggins for taking the time to make this PR happen, and for following up! |
Cool, happy to do that. I've got some work critical stuff this week, but I'll plan on updating this week. I appreciate you getting back to me! :) |
@beauby I've updated the Let me know if there's anything else that needs to be addressed. Thanks! 😄 |
@@ -242,7 +242,7 @@ def test_render_json_with_status | |||
|
|||
def test_render_json_with_callback | |||
get :render_json_hello_world_with_callback | |||
assert_equal 'alert({"hello":"world"})', @response.body | |||
assert_equal '/**/alert({"hello":"world"})', @response.body |
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.
oh weird, shouldn't it have been this the whole time?
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.
Yep, it is currently failing on the 0.8 branch. This fixes it.
Seems like you'll need to add an |
I've never used appveyor. The 0.8 branch was failing historically, so nothing new broke here. Any insight into what I can do to get that working? |
5b30f54
to
4ab6697
Compare
@mhuggins I think the big problems with CI on the 0-8-branch were related to incompatibilities with Rails < 4, and the lack of a Rails version constraint in CI. I've addressed those in #1376 basically copying what we have in master. Hopefully, that should let you focus on the bug your fixing. I included all your CI-specific commits in #1376 |
Cool, I think it's safe to close this PR in favor of that one then. Thanks!! |
Oh, but I left out 2dbc4dd Do you think it's no longer needed? |
Do you think it's worth working on the ruby < 1.9.3, rails < 4.0 test support? |
In the referenced bug you wrote
Which I haven't confirmed if it's still a problem |
Ahh, okay, I misunderstood. I'll reopen a new PR with just that change then, if that works for you. :) |
No need, you can just force push to this branch, |
👍 Will do shortly |
Sorry for the delay, I'm going to make sure to address this during the week. |
This addresses issue #340 for the 0.8.x series. It looks like the existing fix for that issue was not included in that series of active_model_serializers.