Class: BiocurationClassification
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- BiocurationClassification
- Includes:
- Housekeeping, Shared::DwcOccurrenceHooks, Shared::IsData
- Defined in:
- app/models/biocuration_classification.rb
Overview
A BiocurationClassification classifies a CollectionObject within a collection into some biologically-related category. See BiocurationClass.
Instance Attribute Summary collapse
-
#biocuration_class_id ⇒ Integer
the biocuration class ID.
-
#biocuration_classification_object_id ⇒ Integer
id of the object the classification is for.
-
#biocuration_classification_object_type ⇒ String
Baseclass model name the classficiation is for.
-
#position ⇒ Integer
Used with acts_as_list.
-
#project_id ⇒ Integer
the project ID.
Instance Method Summary collapse
Methods included from Shared::IsData
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
Methods included from Housekeeping
#has_polymorphic_relationship?
Methods inherited from ApplicationRecord
Instance Attribute Details
#biocuration_class_id ⇒ Integer
the biocuration class ID
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/biocuration_classification.rb', line 24 class BiocurationClassification < ApplicationRecord include Housekeeping include Shared::DwcOccurrenceHooks include Shared::IsData acts_as_list scope: [:biocuration_classification_object_id, :biocuration_classification_object_type, :project_id] belongs_to :biocuration_class, inverse_of: :biocuration_classifications belongs_to :biocuration_classification_object, polymorphic: true, inverse_of: :biocuration_classifications validates_presence_of :biocuration_class, :biocuration_classification_object validates_uniqueness_of :biocuration_class, scope: [:biocuration_classification_object] def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end protected end |
#biocuration_classification_object_id ⇒ Integer
id of the object the classification is for
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/biocuration_classification.rb', line 24 class BiocurationClassification < ApplicationRecord include Housekeeping include Shared::DwcOccurrenceHooks include Shared::IsData acts_as_list scope: [:biocuration_classification_object_id, :biocuration_classification_object_type, :project_id] belongs_to :biocuration_class, inverse_of: :biocuration_classifications belongs_to :biocuration_classification_object, polymorphic: true, inverse_of: :biocuration_classifications validates_presence_of :biocuration_class, :biocuration_classification_object validates_uniqueness_of :biocuration_class, scope: [:biocuration_classification_object] def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end protected end |
#biocuration_classification_object_type ⇒ String
Returns baseclass model name the classficiation is for.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/biocuration_classification.rb', line 24 class BiocurationClassification < ApplicationRecord include Housekeeping include Shared::DwcOccurrenceHooks include Shared::IsData acts_as_list scope: [:biocuration_classification_object_id, :biocuration_classification_object_type, :project_id] belongs_to :biocuration_class, inverse_of: :biocuration_classifications belongs_to :biocuration_classification_object, polymorphic: true, inverse_of: :biocuration_classifications validates_presence_of :biocuration_class, :biocuration_classification_object validates_uniqueness_of :biocuration_class, scope: [:biocuration_classification_object] def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end protected end |
#position ⇒ Integer
Returns used with acts_as_list.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/biocuration_classification.rb', line 24 class BiocurationClassification < ApplicationRecord include Housekeeping include Shared::DwcOccurrenceHooks include Shared::IsData acts_as_list scope: [:biocuration_classification_object_id, :biocuration_classification_object_type, :project_id] belongs_to :biocuration_class, inverse_of: :biocuration_classifications belongs_to :biocuration_classification_object, polymorphic: true, inverse_of: :biocuration_classifications validates_presence_of :biocuration_class, :biocuration_classification_object validates_uniqueness_of :biocuration_class, scope: [:biocuration_classification_object] def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end protected end |
#project_id ⇒ Integer
the project ID
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/biocuration_classification.rb', line 24 class BiocurationClassification < ApplicationRecord include Housekeeping include Shared::DwcOccurrenceHooks include Shared::IsData acts_as_list scope: [:biocuration_classification_object_id, :biocuration_classification_object_type, :project_id] belongs_to :biocuration_class, inverse_of: :biocuration_classifications belongs_to :biocuration_classification_object, polymorphic: true, inverse_of: :biocuration_classifications validates_presence_of :biocuration_class, :biocuration_classification_object validates_uniqueness_of :biocuration_class, scope: [:biocuration_classification_object] def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end protected end |
Instance Method Details
#dwc_occurrences ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/models/biocuration_classification.rb', line 37 def dwc_occurrences if biocuration_classification_object&.dwc_occurrence DwcOccurrence.where(id: biocuration_classification_object.dwc_occurrence.id) else DwcOccurrence.none end end |