You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/models/challenge_work_score.rb

14 lines
671 B

6 years ago
class ChallengeWorkScore < ApplicationRecord
belongs_to :user
belongs_to :student_work
belongs_to :challenge
has_many :tidings, as: :container, dependent: :destroy
def create_tiding trigger_user_id
tidings << Tiding.new(user_id: student_work.user_id, trigger_user_id: trigger_user_id, container_id: id,
container_type: "ChallengeWorkScore", parent_container_id: student_work_id,
parent_container_type: "StudentWork", belong_container_id: student_work&.homework_common&.course_id,
belong_container_type: "Course", viewed: 0, tiding_type: "HomeworkCommon")
end
6 years ago
end