Rails3: combine scope with OR

前端 未结 3 1736
萌比男神i
萌比男神i 2020-12-09 12:00

I need to combine name scope with or operator... Something like:

class Product < ActiveRecord::Base
  belongs_to :client

  scope :name_a, where(\"product         


        
3条回答
  •  春和景丽
    2020-12-09 12:37

    For Rails 3:

    Person.where(
      Person.where(name: "John").where(lastname: "Smith").where_values.join(' OR ')
    )
    

提交回复
热议问题