Git Product home page Git Product logo

Comments (6)

juddblair avatar juddblair commented on August 26, 2024

I fixed it in my fork: https://github.com/juddblair/closure_tree

Rspec is passing, and I built and tested the gem locally with my application, and everything looks good. I didn't write a breaking test for the implementation, but I can submit a pull request for my fix if you'd like.

from closure_tree.

mceachen avatar mceachen commented on August 26, 2024

Excellent issue request, sir. Thanks for your thoroughness!

I pulled your change onto a new branch, but the weather's too nice to keep typing right now. I think we (and by "we", I don't mean you have to do it) should add a couple breaking tests (to test with a prefix and a suffix), or do something clever with running the whole test suite with Label or Tag with or without a prefix, just to make sure things are working in all environments.

Thanks again for taking the time to write this up!

from closure_tree.

juddblair avatar juddblair commented on August 26, 2024

Sure thing - I started playing around with the tests since, despite the nice weather, I'm under the weather. I added a prefix and suffix to the spec helper and noticed a few things:

  1. The indexes were too long with long prefixes/suffixes. I changed the test table definitions to use explicit index names, which I also had to do in my application. Might be something to fix in the generator if possible.
  2. Suffix was problematic - since we singularize the hierarchy table name and use that to name the class, anything that ended with an "s" (actually any suffixes, but especially seemingly plural ones) threw AR for a loop. I fixed this by escaping the prefix/suffix before singularizing it, and then re-adding them, but the resulting line is...interesting (acts_as_tree.rb:393). Might be a cleaner way to do that but it does work.
  3. A test on cuisine type failed because the table name assertion didn't take prefix/suffix into account. Fixed this.
  4. Several User tests failed because with the addition of prefix/suffix, the supplied table name was no longer correct. Fixed this. As an aside, should we supply the prefix/suffix to custom table names? It seems like we should just accept what people pass in (using a pre-existing table with a different/no prefix/suffix seems to be a good use case, or a shared DB), but I'm not sure how others do this. I'd vote for correct as-is.

Personally, I think the tests should run with all permutations (prefix, suffix, prefix+suffix, neither), but this seems like a good start.

I updated my fork with my changes.

from closure_tree.

mceachen avatar mceachen commented on August 26, 2024

All permutations: http://travis-ci.org/#!/mceachen/closure_tree/builds/2473467

We'll see how it goes.

from closure_tree.

mceachen avatar mceachen commented on August 26, 2024

released 3.6.0. Thanks again for your help!

from closure_tree.

juddblair avatar juddblair commented on August 26, 2024

Sweet! Thanks for the quick turnaround with the release, much appreciated.

from closure_tree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.