Comments (3)
User.create
is a class method, and of course it should have created user as argument. user.save
is instance method, you only can call save
on instance, not on class (User), this is a reason why save callback haven't any arguments except err
, you already should have instance and there's no reason to pass it as argument additionally. Or, maybe I misunderstood smth?
from jugglingdb.
You are right. Create is class method so you do not have access to the object already. Save is an instance method so you already have access. But in this later case, you assume the code will be as follow:
object.save( function(err){ /* access object here */});
What happens if you do not have access to the local var object? As with passed in callback like:
object.save( callback_define_somewhere_else );
from jugglingdb.
Yeah, I got an idea! Thank you for clarifying, will tune as soon as get my laptop working.
On 17.11.2011, at 23:20, Julien [email protected] wrote:
You are right. Create is class method so you do not have access to the object already. Save is an instance method so you already have access. But in this later case, you assume the code will be as follow:
object.save( function(err){ /* access object here */});
What happens if you do not have access to the local var object? As with passed in callback like:
object.save( callback_define_somewhere_else );
Reply to this email directly or view it on GitHub:
#5 (comment)
from jugglingdb.
Related Issues (20)
- README documentation references are not reachable
- is this project dead ? HOT 5
- Potentially unhandled rejection [2] TypeError, when upgrading to new version of node. HOT 1
- Site down HOT 2
- Support multiple hooks per action
- Validations should be revisited
- Deprecate mutation features
- Consider removing all instance methods
- Disallow mixins on Model
- Model relations
- how to query field in multiple values? HOT 1
- Can i use JugglingDB in production? HOT 4
- process rpc message error TypeError: User.bulkUpdate is not a function HOT 2
- How can i delete one record ?
- Is this project maintained? HOT 2
- How to get the table definition from a datasource?
- upsert method doesn't trigger any hooks for mysql adapter HOT 3
- In
- Use in production? HOT 2
- Composite primary keys / composite foreign keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jugglingdb.