Module: Transfer::TransfersToKnownDestination

Included in:
BetweenPlates, BetweenPlatesBySubmission, BetweenSpecificTubes, BetweenTubesBySubmission, FromPlateToTube
Defined in:
app/models/transfer/transfers_to_known_destination.rb

Overview

The transfer goes from the source to a specified destination and this can only happen once.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/models/transfer/transfers_to_known_destination.rb', line 5

def self.included(base)
  base.class_eval do
    belongs_to :destination, class_name: 'Labware'
    validates :destination, presence: true
    validates :destination_id,
              uniqueness: {
                scope: :source_id,
                message: 'can only be transferred to once from the source'
              }
  end
end