Skip to content

Commit

Permalink
Refactoring Models CoursesSubject and UsersCourse 49513
Browse files Browse the repository at this point in the history
  • Loading branch information
aamehedi committed Dec 24, 2015
1 parent 92a25a3 commit 928293f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
19 changes: 2 additions & 17 deletions app/models/courses_subject.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
class CoursesSubject < ActiveRecord::Base
acts_as_paranoid
STATUS = {
new: 0,
started: 1,
finished: 2
}

enum status: [:created, :started, :finished]

attr_accessor :update_status

Expand All @@ -14,16 +11,4 @@ class CoursesSubject < ActiveRecord::Base
has_many :users, through: :users_subjects
has_many :courses_subjects_tasks, dependent: :destroy
has_many :tasks, through: :courses_subjects_tasks

def new?
status == STATUS[:new]
end

def started?
status == STATUS[:started]
end

def finished?
status == STATUS[:finished]
end
end
5 changes: 0 additions & 5 deletions app/models/users_course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ class UsersCourse < ActiveRecord::Base
tracked owner: ->(controller, model) {controller && controller.current_user}
acts_as_paranoid

ASSIGN_TYPE = {
supervisor: "supervisor",
trainee: "trainee"
}

after_create :appened_assigned_users
after_destroy :appened_removed_users

Expand Down

0 comments on commit 928293f

Please sign in to comment.