我的模型看起来像这样:
class Project
include DataMapper::Resource
property :id, Serial
property :title, String
property :slug, String
property :status, Enum[:open, :closed ], :default => :open
has n, :issues
end
如何使用Project.update()将枚举的状态更改为关闭?
答案 0 :(得分:2)
就像那样:
Project.update(:status => :closed)