2017-06-23 21:19:08 +08:00
|
|
|
class MyModuleRepositoryRow < ApplicationRecord
|
2017-06-28 21:21:32 +08:00
|
|
|
belongs_to :assigned_by,
|
|
|
|
foreign_key: 'assigned_by_id',
|
|
|
|
class_name: 'User',
|
|
|
|
optional: true
|
2018-03-16 20:12:33 +08:00
|
|
|
belongs_to :repository_row,
|
2019-01-17 22:04:20 +08:00
|
|
|
optional: true,
|
|
|
|
inverse_of: :my_module_repository_rows
|
|
|
|
belongs_to :my_module,
|
2018-03-16 20:12:33 +08:00
|
|
|
optional: true,
|
2019-01-03 21:11:00 +08:00
|
|
|
touch: true,
|
2018-03-16 20:12:33 +08:00
|
|
|
inverse_of: :my_module_repository_rows
|
2017-06-06 23:35:29 +08:00
|
|
|
|
|
|
|
validates :repository_row, :my_module, presence: true
|
|
|
|
validates :repository_row, uniqueness: { scope: :my_module }
|
|
|
|
end
|