Git Product home page Git Product logo

Comments (1)

zacharygolba avatar zacharygolba commented on July 28, 2024 2

Hey, thanks for using Lux.

I'm new to this. I'm also interested in contributing when I get my bearings.

Looking forward to it! 😃

The reason you are having this issue is because of the way the node-orm2 based Model expects relationships to be defined.

In Lux v0.0.1-beta.7 (current version) defining relationships on your Model is only concerned about the belongsTo side of the relationship. So basically you could prevent this error by only defining the author-post relationship on the the Post model.

Example:

class Post extends Model {
  static hasOne = {
    author: {
      model: 'user',
      reverse: 'posts'
    }
  };
}

Even though you have only defined the relationship one way you will still be able to access .posts from User and you can still keep your serializer the way you would expect the Model relationships to work.

Although that will get rid of that error message, this is still counter-intuitive and not like the rest of the Lux API. That's why we built a custom orm specifically for Lux. #65 is about ready to be merged and will be released in the next version (0.0.1-beta.8). This will allow you to define relationships from both sides as you have in the example above. Check out the test app in the knex branch.

I'm going leave this issue open until #65 is merged and the next version is released. Let me know if you have any more questions about this.

P.S

If you have general questions that are not a potential bug or feature request feel free to join the Lux chat room on Gitter!

from lux.

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.