将数据映射器与红宝石一起使用。假设我有一个名为 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])
=> []
可以查询对象属性吗?