Add and inherit from ApplicationRecord to match Rails 5.0 style
This commit is contained in:
parent
8c6d48da86
commit
abe847c0ee
34 changed files with 56 additions and 66 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
class Task < ActiveRecord::Base
|
||||
class Task < ApplicationRecord
|
||||
has_many :assignments, :dependent => :destroy
|
||||
has_many :users, :through => :assignments
|
||||
belongs_to :workgroup
|
||||
|
|
@ -89,7 +89,7 @@ class Task < ActiveRecord::Base
|
|||
list = ids.split(",").map(&:to_i)
|
||||
new_users = (list - users.collect(&:id)).uniq
|
||||
old_users = users.reject { |user| list.include?(user.id) }
|
||||
|
||||
|
||||
self.class.transaction do
|
||||
# delete old assignments
|
||||
if old_users.any?
|
||||
|
|
@ -112,7 +112,7 @@ class Task < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def user_list
|
||||
@user_list ||= users.collect(&:id).join(", ")
|
||||
end
|
||||
|
|
@ -126,4 +126,3 @@ class Task < ActiveRecord::Base
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue