Retrieve records which have many-to-many association, using ruby and datamapper
问题 I'm learning Sinatra, and I have read datamapper documentation and found this n to n relationship example: class Photo include DataMapper::Resource property :id, Serial has n, :taggings has n, :tags, :through => :taggings end class Tag include DataMapper::Resource property :id, Serial has n, :taggings has n, :photos, :through => :taggings end class Tagging include DataMapper::Resource belongs_to :tag, :key => true belongs_to :photo, :key => true end What I understood from the code above is