2017-06-23 21:19:08 +08:00
|
|
|
class UserMyModule < ApplicationRecord
|
2018-11-20 21:29:33 +08:00
|
|
|
validates :user, presence: true, uniqueness: { scope: :my_module }
|
|
|
|
validates :my_module, presence: true
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-12-13 18:18:09 +08:00
|
|
|
belongs_to :user, inverse_of: :user_my_modules, touch: true, optional: true
|
2017-06-28 21:21:32 +08:00
|
|
|
belongs_to :assigned_by,
|
|
|
|
foreign_key: 'assigned_by_id',
|
|
|
|
class_name: 'User',
|
|
|
|
optional: true
|
2018-09-27 16:43:44 +08:00
|
|
|
belongs_to :my_module, inverse_of: :user_my_modules,
|
2018-12-13 18:18:09 +08:00
|
|
|
touch: true,
|
2018-09-27 16:43:44 +08:00
|
|
|
optional: true
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|