
Tags can be added to exercises in the edit view. Tags can monitored under /tags. Added the concept of ProxyExercises which are a collection of Exercises. They can be found under /proxy_exercises Added Interventions as prework to show interventions later to the user. Added exercise/[:id]/working_time to return the working time of the user in this exercise and the average working time of all users in this exercise
22 lines
288 B
Ruby
22 lines
288 B
Ruby
class Tag < ActiveRecord::Base
|
|
|
|
has_many :exercise_tags
|
|
has_many :exercises, through: :exercise_tags
|
|
|
|
validates_uniqueness_of :name
|
|
|
|
def destroy
|
|
if (can_be_destroyed?)
|
|
super
|
|
end
|
|
end
|
|
|
|
def can_be_destroyed?
|
|
!exercises.any?
|
|
end
|
|
|
|
def to_s
|
|
name
|
|
end
|
|
|
|
end |