I need to implement a query that checks two ids inside all records of a table,
I am trying the following query, but, Its not correct:
if StudentsCourses.all.where(:student_id == current_student.id && :course_id == session[:course_id]).count != 0
# do something
end
where student_id and course_id are foreign keys inside StudentsCourses
also, is there a better way rather than check result count not equal zero ?
You were close!