Have you included the relation.js
file? Per the documentation:
Spine's relationship logic is available in a separate module to the rest of the library, relation.js. You'll need to include that in your application before continuing.
Frage
I have problem with spinejs associations.
class Category extends Spine.Model
@configure 'Category', 'name', 'id'
@extend Spine.Model.Ajax
@hasMany 'children_categories', 'Category'
@url: Route.categories()
but it writes an error
Uncaught TypeError: Object Category(name, id) has no method 'hasMany'
What I am doing wrong? Thanks in advance.
Lösung
Have you included the relation.js
file? Per the documentation:
Spine's relationship logic is available in a separate module to the rest of the library, relation.js. You'll need to include that in your application before continuing.