I have a connection table that connects between 2 tables. It has 2 columns: user_id and course_id. The name of the table is: course_sub_managers. This table does not have an index. So, how do I delete all rows that meet a condition in which course_id = certain variable? As for now I use:
sql = "DELETE FROM course_sub_managers WHERE course_id = " + @course.id.to_s
ActiveRecord::Base.connection.execute(sql)
Is there a Rails way to write it?
I suspect you have an course model where you have written something like:
in that case you can use: