开发者

Datamapper update enum

开发者 https://www.devze.com 2023-01-28 10:11 出处:网络
My model looks like this: class Project include DataMapper::Resource property:id, Serial property:title, String

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

精彩评论

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