Spine.js has_many:通过

问题描述 投票:1回答:1

我仍然围绕着Spine JS,这是非常聪明的酷东西。我看到它支持Model Relationships,但我似乎无法找到有关has_many :through关系的任何信息。

我猜它不可能,有人知道它是不是?

ruby-on-rails spine.js
1个回答
0
投票

迟到了五年,但Spine.js没有has_many关系。

引用source code,它只有belongsTo,hasOne和hasMany:

  Spine.Model.extend({
    hasMany: function(name, model, fkey) {
      if (fkey == null) {
        fkey = (underscore(this.className)) + "_id";
      }
      return this.prototype[name] = function(value) {
        return association(name, model, this, fkey, Collection).refresh(value);
      };
    },
    belongsTo: function(name, model, fkey) {
      if (fkey == null) {
        fkey = (underscore(singularize(name))) + "_id";
      }
      this.prototype[name] = function(value) {
        return association(name, model, this, fkey, Instance).update(value).find();
      };
      return this.attributes.push(fkey);
    },
    hasOne: function(name, model, fkey) {
      if (fkey == null) {
        fkey = (underscore(this.className)) + "_id";
      }
      return this.prototype[name] = function(value) {
        return association(name, model, this, fkey, Singleton).update(value).find();
      };
    }
  });
© www.soinside.com 2019 - 2024. All rights reserved.