Type something to search...

Arel

使用 Arel 寫出好看的 Left Join
使用 Arel 寫出好看的 Left Join

之前想要寫有條件的 left join 都會寫成 raw SQL query 的字串,但是其實也可以用 Arel 寫出比較好看的程式碼。 假設有個 DB 的 schema 長這樣: create_table "posts", force: :cascade do |t| t.string "title" t.boolean "active" t.integer "u

read more