Üç Kayıtlı and
koşulu (iki) ve iki or
koşuluyla Aktif Kayıt yazmak istiyorum.Aktif Kayıt, "ve" ve "veya" koşullarında Ruby'de nasıl yazılır
@properties = Property.where(category_id: 2).
where(status: 3).
where(p_type: 'sell')`
Bu and
koşullarla sorgu listelenmektedir:
Sonunda iki adet or
koşulunu eklemem gerekiyor.
@properties = Property.where(category_id: 2).
where(status: 3).
where(p_type: 'sell').
or(location: @location).
or(featured: '1)`
?
bu '@properties = Property.where (category_id: 2, statü: 3) deneyebilirsiniz .Where ("??? (P_type = VEYA konum = VEYA özellikli =)", 'sat', @ konum, '1') ' –
Teşekkür ederim. Bu kod çalışıyor :) – SreRoR
'nerede(). or()' yöntem zinciri Raylar 5'te mevcut olacaktır. [buraya] eklenmiştir (https://github.com/rails/rails/pull/16052/) . – Drenmi