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

[GitBook] Create() Method Documentation Improvement #245

Open
homestar9 opened this issue Jan 25, 2024 · 0 comments
Open

[GitBook] Create() Method Documentation Improvement #245

homestar9 opened this issue Jan 25, 2024 · 0 comments

Comments

@homestar9
Copy link
Contributor

@elpete, I no longer have access to the Quick documentation on Gitbook for some reason, so I'm posting my suggestion here:

On the page: https://quick.ortusbooks.com/guide/getting-started/creating-new-entities#create
It is critically important to let users know the create() method returns a brand new entity, and does not persist the current entity which may have called it.

Example:

prc.user = getInstance( "User" ).newEntity();

// danger Will Robinson! This will not update prc.user.
prc.user.create( {
 "firstName": "Dave"
} );

writeDump( prc.user.isLoaded() ); // <--- WILL BE FALSE!

If you want to use create, you must do this instead:

prc.user = getInstance( "User" ).newEntity();

// in order for this to work, you must replace the original variable.
prc.user = prc.user.create( {
 "firstName": "Dave"
} );

writeDump( prc.user.isLoaded() ); // <--- WILL BE TRUE
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

1 participant