class Conversation < ActiveRecord::Base
enum status: [ :active, :archived ]
end
Of course, you can also query them directly if the scopes don't fit your needs:
Conversation.where(status: [:active, :archived])
Conversation.where.not(status: :active)
太需要这个 enum 功能了,不知道什么时候才能从 edge 更新到 Rails 新版本! 请教目前(Rails4.2.5)有什么简单而且高效的方法能实现以上功能,谢谢!