0

将数据映射器与红宝石一起使用。假设我有一个名为 Post 的模型:

class Post
  include DataMapper::Resource
  property :id, Serial
  property :name, String, length: 255
  property :category_ids, Object
end

Post.create(name: 'My post', category_ids: [1,2,3])

Post.all(category_ids: [1])
=> []
Post.all(category_ids: [1,2,3])
=> []

可以查询对象属性吗?

4

1 回答 1

0

使用Range.Post.all(category_ids: (1..3))

于 2013-10-14T19:52:31.260 回答