最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

ActiveRecord或查詢哈希符號(hào)

ActiveRecord或查詢哈希符號(hào)

我知道有3種主要符號(hào)為whereActiveRecord方法提供參數(shù):純弦數(shù)組雜湊指定and的where方法是直截了當(dāng):# Pure String notationPerson.where("name = 'Neil' AND age = 27")# Array notationPerson.where(["name = ? AND age = ?", 'Neil', 27])# Hash notationPerson.where({name: "Neil", age: 27})指定or相同的where方法讓我很困惑哈希語(yǔ)法??赡軉??# Pure String notationPerson.where("name = 'Neil' OR age = 27")# Array notationPerson.where(["name = ? OR age = ?", 'Neil', 27])# Hash notation DOESN'T WORKPerson.where({name: "Neil" OR age: 27})
查看完整描述

2 回答

?
FFIVE

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊

正如potashin所說(shuō),您可以使用另一個(gè)實(shí)現(xiàn)此功能的第三方插件。我使用Squeel的時(shí)間很長(zhǎng),為此和其他功能(例如復(fù)雜的子查詢或聯(lián)接)工作得很好。


該查詢使用squeel:


@people= Person.where{(name == 'Neil') | (age = 27)}


查看完整回答
反對(duì) 回復(fù) 2019-11-28
  • 2 回答
  • 0 關(guān)注
  • 655 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)