Module: V1::Shared::RunSuitability
- Extended by:
- ActiveSupport::Concern
- Included in:
- Pacbio::AliquotResource, Pacbio::LibraryResource, Pacbio::PoolResource
- Defined in:
- app/resources/v1/shared/run_suitability.rb
Overview
Include in a resource to add the run suitability attribute which evalutates if the resource can be used to generate a run. It does this by:
- Calling valid? in the run_creation context @see https://guides.rubyonrails.org/active_record_validations.html#on
- Uses the JsonAPI resources ValidationErrors object to generate JSON-API compatible errors objects. Status is removed as it is not relevant in this context. @see https://jsonapi.org/format/#error-objects
Instance Method Summary collapse
Instance Method Details
#run_suitability ⇒ Object
18 19 20 21 22 23 |
# File 'app/resources/v1/shared/run_suitability.rb', line 18 def run_suitability { ready_for_run: @model.valid?(:run_creation), errors: inline_errors_object } end |