Tag: 欧姆

与Ruby,Redis和Ohm的多对多关系

我正在尝试使用Ohm在Redis中创建多对多关系。 例如,我的Book和Author模型定义如下: class Book < Ohm::Model attribute :title set :authors, Author end class Author < Ohm::Model attribute :last_name attribute :first_name set :books, Book end 我希望能够做的是利用欧姆的索引function来执行以下搜索: require ‘test_helper’ class ManyToManyRelationshipTest < ActiveSupport::TestCase setup do @dave_thomas = FactoryGirl.build(:dave_thomas) @andy_hunt = FactoryGirl.build(:andy_hunt) @chad_fowler = FactoryGirl.build(:chad_fowler) @pick_axe = FactoryGirl.build(:pick_axe) @pick_axe.authors << @dave_thomas @pick_axe.authors << @andy_hunt @pick_axe.authors << @chad_fowler @thinking_and_learning […]