开发者

Datamapper update enum

My model looks like this:

class Project
    include DataMapper::Resource
    property    :id, Serial
    property    :title, String
    property    :slug,  Stri开发者_C百科ng
    property    :status, Enum[:open, :closed ], :default => :open
    has n, :issues
end

How do I use Project.update() to change the status of the enum to closed?


Just like that:

Project.update(:status => :closed)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜