Skip to content
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

Fixed a couple of issues in query plugin. #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 26, 2014

  1. Fix a couple of issues.

    Two issues found while implementing a site using this plugin:
    
    1. interpolate was crashing on the last part[i] iteration because parts array is often one element larger than args array.
    
    Fixed by adding graceful handling for undefined args[i].
    
    2. In my tests, args.length was never equal to 1, so the callback function was never being called. This was trying test that the last argument was a callback, but wasn't working.
    
    Fixed by changing the test to look at the last arg and check directly that it is a function. The callback is now called as expected.
    
    
    These fixes allowed me to write queries like this:
    
        db.where('this.rec.address1.match(/?/i) || this.rec.address2.match(/?/i)',searchFor,searchFor,function(recs) {
            $.each(recs, function(i,rec) {
                console.log(rec);
            });
        });
    
    Previously the query plug-in only worked if the query string ended with a ? placeholder.
    Spudley committed Mar 26, 2014
    Configuration menu
    Copy the full SHA
    227fcdf View commit details
    Browse the repository at this point in the history