8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/merit/generators/merit_generator.rb', line 8
def inject_merit_content
if model_exists?
inject_into_class(model_path, class_name, " ### END ###\n\n")
inject_into_class(model_path, class_name, " has_many :created_badges, class_name: 'Merit::Badge', :dependent => :destroy\n")
inject_into_class(model_path, class_name, " has_many :assigned_badges, through: :sash, source: :badges, :dependent => :destroy\n")
inject_into_class(model_path, class_name, " belongs_to :sash, foreign_key: 'sash_id', class_name: 'Merit::Sash', :dependent => :destroy\n")
inject_into_class(model_path, class_name, " has_merit\n")
inject_into_class(model_path, class_name, " ### QALAM_MERIT ###\n")
inject_into_class(course_path, "Course", " ### END ###\n\n")
inject_into_class(course_path, "Course", " has_many :badges_sashes, class_name: 'Merit::BadgesSash', :as => :context, :inverse_of => :context, :dependent => :destroy\n")
inject_into_class(course_path, "Course", " has_many :score_points, class_name: 'Merit::QalamScore::Point', :as => :context, :inverse_of => :context, :dependent => :destroy\n")
inject_into_class(course_path, "Course", " ### QALAM_MERIT ###\n")
end
end
|