This project is archived and is in readonly mode.

#5787 ✓stale
ara.t.howard

rails makes it *impossible* to use any 3rd party json libs to generate pretty json

Reported by ara.t.howard | October 11th, 2010 @ 05:55 PM

Comments and changes to this ticket

  • Ryan Bigg

    Ryan Bigg October 11th, 2010 @ 11:32 PM

    • State changed from “new” to “incomplete”
    • Importance changed from “” to “Low”

    If you'd like this fixed in Rails please attach a patch as per the http://guides.rubyonrails.org/contributing_to_rails.html guide.

  • ara.t.howard

    ara.t.howard October 12th, 2010 @ 01:29 AM

    i'm not exactly sure what you mean. the 'patch' is just not to require 'json'. if one does that all the tests pass - of course.

    this isn't something one can really fix with tests. should it submit a patch for each version of the json gem? for some a given test will fail and, for others, different tests will fail. not many, but 1 or 2 different ones. i'm pretty sure you aren't suggesting submitting a patch that test all permutations of gems one might possibly load - right?

    more problematic is that, but requiring and alternate json gem the user is asserting that he wants different json generation/parsing - that's the whole point.

    so, i guess i'm not following. there is no bug, just bad form on rails part which is really hard to fix on the user end: the code is marked with the comment 'hack' - which it is. the fix is simply to remove the hack.

  • Ryan Bigg

    Ryan Bigg October 12th, 2010 @ 03:12 AM

    • State changed from “incomplete” to “invalid”

    So it's unpatchable and untestable and only results in problems if somebody requires 'json', which makes it a non-Rails issue?

    Sorry, can't help you.

  • Ryan Bigg

    Ryan Bigg October 12th, 2010 @ 03:13 AM

    • State changed from “invalid” to “incomplete”

    If you want to see this fixed: please suggest an alternative.

  • ara.t.howard

    ara.t.howard October 12th, 2010 @ 03:23 AM

    the alternative is simple: rather than

    1) requiring the json gem and then clobbering all it's code

    do instead

    2) do nothing. let the json gem maintainers provide bug fixes for rails compatibility

    as it stands now it's just a massive hack (as the author states in the code). not only does it literally require a gem and then clobber it's method to death, but it introduces dependency issues since it does the hack outside of bundler and then loads the app inside of bundler - aka it can result in two json verions being loaded/blowing up.

    all i'm saying is that it would be more clean to remove the code marked 'hack', which breaks no tests, and then to let actual bug reports come in (to rails or json.gem) than to make the person yelling foul provide alternatives when none are needed...

    summary: do nothing.

    it works fine, just slightly differently (as intended) when the json gem is loaded - user beware! actually, maybe that is the best approach: issue a warning after initialize if the json gem has been loaded... hrm.

  • ara.t.howard

    ara.t.howard October 12th, 2010 @ 03:25 AM

    ps. if you've ever worked on an extensive /api you'll see just how nice using JSON.pretty_generate in development actually is - it saves hours of debugging time. and, of course, it is way faster.

  • Ryan Bigg

    Ryan Bigg October 19th, 2010 @ 08:26 AM

    • Tag cleared.

    Automatic cleanup of spam.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:48 PM

    • State changed from “incomplete” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:48 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages