Reputation: 4410
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.
Upvotes: 1
Views: 134
Reputation: 96497
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.
Upvotes: 1