I'm trying to GET all Activities (belongs_to :student) related to a Student (has_many :activities) using this in my controller:
@activities = Activity.joins(:student).where(student: {student_id: @student.id})
However I'm getting this as an error:
SQLite3::SQLException: no such column: student.student_id: SELECT "activities".* FROM "activities" INNER JOIN "students" ON "students"."id" = "activities"."student_id" WHERE "student"."student_id" = ?
join
here, why not justActivity.where(student: @student)
? – Nick Tomlin