2013-02-23 17 views
1

我有Spinejs關聯的問題。Spinejs。沒有方法'hasMany'

class Category extends Spine.Model 
    @configure 'Category', 'name', 'id' 
    @extend Spine.Model.Ajax 

    @hasMany 'children_categories', 'Category' 
    @url: Route.categories() 

,但它將錯誤寫入

Uncaught TypeError: Object Category(name, id) has no method 'hasMany'

我做錯了嗎?提前致謝。

回答

1

您是否包含relation.js文件?根據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.