Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit 9dde145

Browse files
committed
package update + version 2.5
1 parent 646d749 commit 9dde145

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

docs/definition.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -270,19 +270,7 @@ The `options` parameter takes additional attributes:
270270
this.belongsToPolymorphic('children', {typeField: 'children_class'}) // if we have a model with a `children_class` and `children_id` fields
271271
```
272272

273-
### "hasManyThrough"
274-
There is no method like `hasManyThrough()`, but instead you could use `hasMany()` or `hasOne()` with the option `through`.
275-
276-
```js
277-
// models/User.js
278-
this.hasMany('posts')
279-
this.hasMany('unread_posts', {through: 'posts', relation: 'unread'})
280-
281-
// models/Post.js
282-
this.hasMany('unread')
283-
```
284-
285-
### "has"
273+
### "has(name, options)"
286274
If you need to create a custom query to fetch your relational data:
287275

288276
```js
@@ -307,6 +295,19 @@ The `query` method will be called with the current `store` and a list of parent
307295
The `convert` method will be called for every parent record and will provide the result of your Promise in the second argument.
308296
Return the relational result for the given parent record!
309297

298+
299+
### "hasManyThrough"
300+
There is no method like `hasManyThrough()`, but instead you could use `hasMany()` or `hasOne()` with the option `through`.
301+
302+
```js
303+
// models/User.js
304+
this.hasMany('posts')
305+
this.hasMany('unread_posts', {through: 'posts', relation: 'unread'})
306+
307+
// models/Post.js
308+
this.hasMany('unread')
309+
```
310+
310311
## Scopes
311312

312313
Scopes are a way to predefine conditions or add other functionality to your models.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openrecord",
3-
"version": "2.4.1",
3+
"version": "2.5.0",
44
"description": "Active record like ORM for nodejs",
55
"license": "MIT",
66
"keywords": [
@@ -74,7 +74,7 @@
7474
"pg": "^7.5.0",
7575
"prettier": "^1.14.3",
7676
"restify": "^7.2.1",
77-
"semver": "^5.5.1",
77+
"semver": "^5.6.0",
7878
"should": "^13.2.3",
7979
"sqlite3": "^4.0.2",
8080
"webpack": "^4.20.2",

0 commit comments

Comments
 (0)