7
Tôi muốn tìm các bản ghi dựa trên nhiều thông số. Nhưng những thông số đó là tùy chọn mupltiple.Đường ray Ruby - cách tìm nhiều tùy chọn?
As "SELECT something FROM mytable WHERE user_name="xyz" and status=("Active" OR "Deleted")
Làm cách nào để dịch thuật ngữ này thành tuyên bố đường ray?
Person.find_by_user_name_and_status(user_name, status) # this doesn't take the OR operator
Cảm ơn! mà làm việc, tôi chỉ làm cho nó tìm _all_by thay vì find_all. toán tử OR được diễn đạt. 'Person.find_all_by_user_name_and_status (user_name, [" active "," deleted "])' –
Ví dụ thứ hai không hoạt động: Person.where (: user_name => "xyz"). Where (: status => ["active", "đã xóa"]) –