loopback icon indicating copy to clipboard operation
loopback copied to clipboard

How can i check available related models on relation type "referencesMany" ?

Open bluestaralone opened this issue 12 years ago • 3 comments

In case i want to create a Book which belong to categories, so i must create relation on Book model like this:

"relations": {
    "categories": {
      "type": "referencesMany",
      "model": "Category"
    }
}

But when i create a Book i want to check categories info of Book are available on Category model, how can i do it ? please help me, thanks

bluestaralone avatar Oct 03 '14 05:10 bluestaralone

You should be able to set up beforeCreate hook for the Book model so that you can do the check of categories.

raymondfeng avatar Oct 03 '14 16:10 raymondfeng

Hi @bluestaralone,

Does Raymond's answer solve your problem? If no please share a sample repo using our loopback-sandbox so we can comment on your code; also we encourage you to ask your question in our Google community so people can answer your question easily.

Thanks

Amir-61 avatar Dec 15 '15 20:12 Amir-61

I will be closing this issue due to inactivity; please feel free to re-open it if you run into the same issue and we can look into it further.

Thanks!

Amir-61 avatar Dec 22 '15 16:12 Amir-61