Git Product home page Git Product logo

Comments (6)

danielspaniel avatar danielspaniel commented on May 10, 2024

Hmmm .. that is a good point .. about partial matches. I think that the idea was only to provide exact match, and I never considered partial match because it was kind of difficult. I tried your code above and it did not actually work. If you can prove otherwise send me a test I can run?
Is this a big need you think, for partial match? I was hoping to get away with exact match and call it a day.

from ember-data-factory-guy.

yratanov avatar yratanov commented on May 10, 2024

Yes, it is a big need. In most of the cases I don't want to set all fields.

I have taken a look into this and it seems that the problem is

hash.data = JSON.stringify(hash.data);

line in ember-data. Mockjax can't match it partially (since it is a string), it means we can't do this: $.mockjax({url: '/test', data: {test: {some: 'test'}}})

Just curious why ember data "stringifies" data object. JQuery can handle it...

from ember-data-factory-guy.

danielspaniel avatar danielspaniel commented on May 10, 2024

There may be a way around this .. I am going to try an experiment this weekend to see if I can get the partial match working.
Do you think it's beneficial to have two different ways to match like:

handleCreate('person', { partial_match: { name: 'blah' } })
handleCreate('person', { exact_match: { name: 'blah', age: 30 } })

I am thinking that sometimes you might want an exact match sometimes??

from ember-data-factory-guy.

yratanov avatar yratanov commented on May 10, 2024

@danielspaniel I think if you can do partial_match, we do not need exact match, just match. When I see match: {field: 'value'} I expect that field value must be "value", I don't tell anything else about rest of the fields with this code, IMO.

from ember-data-factory-guy.

danielspaniel avatar danielspaniel commented on May 10, 2024

Right .. I see what you mean .. just match as many attributes as you have. Ok .. will work on the partial match and let you know when I am done.

from ember-data-factory-guy.

danielspaniel avatar danielspaniel commented on May 10, 2024

@yratanov, this issue is now fixed in v0.9.5. Ie. you can now do partial matches.
Check it out and let me know if you see any problems though.

from ember-data-factory-guy.

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.