我有以下关系:
User has_many :relationships
has_many :friends, :through => :relationships
Friend has_many :relationships
Relationship belongs_to :user, :friend
现在,我想更新friends
一个用户,还要更新weight
. relationships
我应该怎么做?
我试过
Friend
accept_nested_attribute_for :relationships
和
friend = my_user.friends.first
#update info
friend.update_attributes(:info => my_info, :relationship => {:weight => 1})
在更新其权重属性之前,我应该如何查看用户和朋友之间的特定关系?