在Rails 3中向OR作用域添加OR语句

lem*_*ger 1 activerecord scope named-scope ruby-on-rails

是否可以在rails模型中的范围参数中添加OR语句

scope :west_coast, where(:st => "CA" || "WA" || "OR")
Run Code Online (Sandbox Code Playgroud)

AJc*_*dez 5

问题是如何WHERE ... IN使用activerecord 创建一个sql 语句:

scope :west_coast, where(st: %w(CA WA OR))
Run Code Online (Sandbox Code Playgroud)