标签: ruby-on-rails ruby-on-rails-4
class Conversation < ActiveRecord::Base enum status: [ :active, :archived ] end
如何构建where查询以获取status属性设置为:active的对象?
status
:active
以下全部返回:
Conversation.where(status: "active")
答案 0 :(得分:2)
这应该有效:
Conversation.active