Class: PickList::RecordCache
- Inherits:
-
Object
- Object
- PickList::RecordCache
- Defined in:
- app/models/pick_list/record_cache.rb
Overview
The record cache collects all ids used in the request and optimizes the lookup into a single query, with appropriate eager loading. Built for use with Api::V2::PickListResource
Direct Known Subclasses
Defined Under Namespace
Classes: ByLabware, ByReceptacle
Constant Summary collapse
- RECEPTACLE_KEYS =
%i[source_receptacle_id study_id project_id].freeze
- LABWARE_KEYS =
%i[source_labware_id source_labware_barcode study_id project_id].freeze
Instance Method Summary collapse
- #add(entry) ⇒ Object
-
#initialize(picks) ⇒ RecordCache
constructor
Create a new cache.
Constructor Details
#initialize(picks) ⇒ RecordCache
Create a new cache
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'app/models/pick_list/record_cache.rb', line 91 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
Instance Method Details
#add(entry) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'app/models/pick_list/record_cache.rb', line 96 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |