Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Model.set does not call Model.parse, unlike Collection.set #4038

Open
JSteunou opened this issue May 31, 2016 · 3 comments
Open

Model.set does not call Model.parse, unlike Collection.set #4038

JSteunou opened this issue May 31, 2016 · 3 comments

Comments

@JSteunou
Copy link

I stumble on a case where I did not understand why my model.set called with {parse: true} did not call the parse method. I was very surprise to discover that parse must be called manually before a model.set whereas an option {parse: true} is enough for Collection.

Why Collection automatically parse inside the set when option parse is true, whereas Model does the parse outside the set ? Model fetch/save/constructor do call the parse method with options.parse on true, set is really the only method with a weird behaviour. Is there a good reason?

@jridgewell
Copy link
Collaborator

This would be addressed in #3758. Also #4035?

@JSteunou
Copy link
Author

I though there was a particular hidden reason but I see I'm not the only one bugged by this :D

The PR should indeed harmonize the #set #parse behaviour among collection & model also I am more in favour to add the #parse into the model#set.

@jgonggrijp
Copy link
Collaborator

I looked into this, and I agree there is an inconsistency here. I have not looked deeply into the reason for it, but it might very well be found in the chain of reversions mentioned in #3758. I suspect this is a subissue of #4266.

I think I also agree that Model.set should listen to the parse option like Collection.set. However, action should be taken only with extreme care and a coherent plan.

@jgonggrijp jgonggrijp changed the title Question about model#parse Model.set does not call Model.parse, unlike Collection.set Jul 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants