【问题标题】:How to get record by ripple many association?如何通过涟漪多关联获取记录?
【发布时间】:2013-04-09 15:53:19
【问题描述】:

我想通过涟漪https://github.com/basho/ripple 将数据保存到riak,并创建一个模型:

class Person
  include Ripple::Document
  property :name, String
  many :friends, :class_name => "Person"
end

如果有两个人模型实例,如何知道一个人是否是另一个人的朋友?喜欢:

person.friends.get(somekey)

【问题讨论】:

    标签: ruby riak ripple


    【解决方案1】:

    person.friends 是一个数组,你可以这样称呼它:

    person.friends.include? otherperson
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-25
      • 1970-01-01
      • 2011-05-09
      相关资源
      最近更新 更多