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

.reload() #54

Closed
yratanov opened this issue Jan 16, 2015 · 8 comments
Closed

.reload() #54

yratanov opened this issue Jan 16, 2015 · 8 comments

Comments

@yratanov
Copy link
Contributor

Calling .reload() causes weird request: GET http://localhost:7357/companies/1/tests/index.html 404 (Not Found).

@danielspaniel
Copy link
Collaborator

Hmm .. that is kind of an odd url for a reload. What is the context for this? Can you recreate this somehow in a test? ( I am guessing not? ) .. Maybe by using a mock like:
factoryGuy.testMixin.stubEndpointForHttpRequest( '/companies/1', {id:1})
will do the trick? Since, if in your application calling .reload on a model needs to be mocked .. and I am guessing (hoping) the url your getting is throwing you off and just letting you know ( hey, please mock the reload url .. even though the url I am showing you is stupid )

@yratanov
Copy link
Contributor Author

I expected that if I have

    company = factoryGuyHelper().make('company')

Then when the company is reloaded in the app it will not do a request. But it seems I need to do
something like this:

factoryGuyHelper().handleFindOne('company', id: 1)

@danielspaniel
Copy link
Collaborator

Only problem with the handleFindOne is that is makes the record, so it's not good for just handling reload. Unless you use it for making and then also handling reload ( if you know what I mean ) ..

@Marthyn
Copy link
Contributor

Marthyn commented Jan 16, 2015

Yeah, i thought of that too, you should be able to pass the object you want to return too, (you can of course pass all attributes and have the same result)

@yratanov
Copy link
Contributor Author

@Marthyn 👍

@danielspaniel
Copy link
Collaborator

@yratanov , @Marthyn, I added ability to handle reload in handleFindOne , because you can now pass in an existing record. Check it out in v0.9.5 and let me know what you think.

Also, I hope you don't get too upset, but I deprecated handleFindOne in favor of just handleFind
I did same for handleFindMany to handleFindAll because the names now match what ember data is doing with store.find or store.findAll

@yratanov
Copy link
Contributor Author

@danielspaniel Thank you 👍

@Marthyn
Copy link
Contributor

Marthyn commented Jan 19, 2015

Oh this is much better! Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants