{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/f855324f298eb7708e39ea117477cbd5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"f855324f298eb7708e39ea117477cbd5","url":"https://api.github.com/users/d11wtq","login":"d11wtq","id":37948},"milestone":null,"assignee":null,"labels":[],"updated_at":"2011-10-29T11:55:35Z","comments":0,"closed_at":null,"url":"https://api.github.com/repos/datamapper/dm-core/issues/161","body":"This affects the `InMemoryAdapter` and any other non-SQL adapters that rely on `Query#filter_records`.\r\n\r\n``` ruby\r\nrequire \"dm-core\"\r\n\r\nDataMapper.setup(:default, :adapter => :in_memory)\r\n\r\nclass Post\r\n  include DataMapper::Resource\r\n\r\n  property :id,    Serial\r\n  property :title, String\r\n\r\n  has n, :tags, :through => Resource\r\nend\r\n\r\nclass Tag\r\n  include DataMapper::Resource\r\n\r\n  property :id,   Serial\r\n  property :slug, String\r\n\r\n  has n, :posts, :through => Resource\r\nend\r\n\r\nDataMapper.finalize\r\n\r\npost = Post.new(:title => \"a post\")\r\ntag  = post.tags.new(:slug => \"a-tag\")\r\n\r\n[post, tag].each { |r| r.save }\r\n\r\np post.tags           # => [#<Tag @id=1 @slug=\"a-tag\">]\r\np post.post_tags.tags # => [#<Tag @id=1 @slug=\"a-tag\">]\r\np tag.posts           # => []\r\np tag.post_tags.posts # => [#<Post @id=1 @title=\"a post\">]\r\n\r\nputs \"Reloading post (clearing instance variables)\"\r\npost.reload\r\n\r\np post.tags           # => []\r\np post.post_tags.tags # => [#<Tag @id=1 @slug=\"a-tag\">]\r\np tag.posts           # => []\r\np tag.post_tags.posts # => [#<Post @id=1 @title=\"a post\">]\r\n```\r\n\r\nThe adapter is just doing:\r\n\r\n``` ruby\r\nquery.filter_records(records_for(query.model).dup)\r\n```\r\n","html_url":"https://github.com/datamapper/dm-core/issues/161","number":161,"title":"Query#filter_records does not understand many-to-many relationships","id":2086731,"created_at":"2011-10-29T11:55:35Z"},"action":"opened"}