scinote-web/app/models/my_module_repository_row.rb

17 lines
547 B
Ruby
Raw Normal View History

2017-06-23 15:19:08 +02:00
class MyModuleRepositoryRow < ApplicationRecord
2017-06-28 15:21:32 +02:00
belongs_to :assigned_by,
foreign_key: 'assigned_by_id',
class_name: 'User',
optional: true
belongs_to :repository_row,
optional: true,
inverse_of: :my_module_repository_rows
belongs_to :my_module,
optional: true,
touch: true,
inverse_of: :my_module_repository_rows
2017-06-06 17:35:29 +02:00
validates :repository_row, :my_module, presence: true
validates :repository_row, uniqueness: { scope: :my_module }
end