GithubHelp home page GithubHelp logo

Comments (3)

1602 avatar 1602 commented on August 18, 2024

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.

juggy avatar juggy commented on August 18, 2024

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.

1602 avatar 1602 commented on August 18, 2024

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)

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.