Comments (1)
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)
- Disconnect event not listened to on worker shutdown
- Generate type descriptors for TypeScript and Flow
- Error un cluster module usage
- Offer access to data gathered from queries in actions after they are executed.
- Support custom filters HOT 5
- api requests made over https contain links to http endpoints (not https) (when behind a reverse proxy/load balancer)
- Update for changes in remark, remark-lint
- Partial updates with PATCH not working HOT 2
- Updating hasMany => through relationships HOT 2
- (page) links not serialized properly when one of the params is a date HOT 2
- Attribute added in `beforeCreate` hook not serialized into payload HOT 1
- db:create with mysql : unknown database
- Model scope method is not a function
- db seed with mysql database : Cannot read property 'concat' of undefined
- Relationship with falsy ID (i.e. 0) not serialized HOT 3
- Circle v1 not supported after Aug 31, 2018
- [BUG] PK not set properly when creating a record w/ a hasOne relationship HOT 1
- Controller params default to empty array, not to serializer attributes
- Switch from fb-watchman to chokidar
- include nested relationship HOT 2
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 lux.