class StudentActivityStudent < ApplicationRecord
  include Base::StudentActivityStudent

  associations_for legacy: true do |a|
    a.belongs_to :school
  end

  belongs_to :activity, foreign_key: :SAID, class_name: 'StudentActivity',
    inverse_of: :activity_students
  belongs_to :student, foreign_key: :StudentID, inverse_of: :student_activities
  belongs_to :school_year, foreign_key: :SchoolYearID, inverse_of: :student_activity_students

  scope :by_activity_ids, ->(ids) { where(activity_id: ids) if ids.present? }
end
