I am trying to implement a has many through relationship as elaborated here. However, my related model is the same as the referring model by means of a self-join. I tried this:
class Article extends Batman.Model
@hasMany 'citations'
@hasMany 'usages', name: 'Citation', foreignKey: 'referenced_article_id'
@accessor 'referenced_articles', ->
@get('citations').mappedTo('referenced_article')
class Citation extends Batman.Model
@belongsTo 'article'
@belongsTo 'referenced_article', name: 'Article'
Unfortunately, calling my_article.get('referenced_articles')
gives an error. Any ideas?
Ah, shoot. I didn't add
mappedTo
toSetProxy
in 0.16. It's fixed with this PR: https://github.com/batmanjs/batman/pull/1052You could either get master from batmanjs.org/download.html or monkey-patch it with:
(That's what I was doing til I updated to master)
Sorry!!