Artificial intelligent assistant

OR検索にて一つ目の条件に一致するものをふたつ目の条件よりも前に表示したい `ticker``name``Company` `ticker``name` Company.where('ticker=? OR name ilike ?', str, "%#{str}%") `ticker` 2 Company.where(ticker: str) + Company.where('name like ?',"%#{str}%") `Array`Pagination `OR`

SQL `CASE WHEN ... THEN ... END` `order`


Company
.where('ticker = ? OR name ilike ?', str, "%#{str}%")
.order(%{
CASE WHEN ticker = #{Company.sanitize str} THEN 0 ELSE 1 END,

})


※ Pagination (`id` `name` )

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2f261627975c2eb28558262cda331c21