-
Add
Annotation::include_valuesas a named scope that can be used to potentially improve performance. -
Added
include_valuesoptional argument (default: false) to as many finder methods. This allows you to specify whether value records must be included in the query results or not, and may be used to improve performance.
-
New config option:
Annotations::Config.value_factories- support for value object generation factories per attribute name.
Example:
Annotations::Config.value_factories["tag"] = Proc.new { |v| case v when String, Symbol Tag.find_or_create_by_name(v.to_s) else v end }
IMPORTANT: don’t use explicit +return+s in your Proc otherwise it will cause the returning method to exit too!
-
The process of generating/setting the annotation’s actual value object has been changed to “lazy generate” the actual
valueobject of the annotation. This is now done before validation. NOTE: this still allows +Annotation#value+ (which has been overridden) to be set at any time, but the actual setting of the value association at the ActiveRecord level now happens later. -
The
process_value_adjustmentscode in theAnnotationmodel now happens BEFORE setting the value association. This prevents the value object from being modified after it’s been set. NOTE: this does also mean that it will only run when provided with a String or Symbol. -
New config option:
Annotations::Config.valid_value_types- support for validation checks based on the class of the value object.
Example:
Annotations::Config::valid_value_types["tag"] = "Tag"
-
Minor bugfixes
-
annotations_version_funows allows reloading of the versioned columns (needed if doing something during a migration).
-
acts_as_annotatablenow requires you to specify an option -:name_field- on the model that is becoming an annotatable. -
acts_as_annotatablenow exposes anis_annotatableattribute to allow you to check if a model can act as an annotatable.
-
Updated the routes to allow
requirementsto be passed in.
*Main change*: Annotation values are now polymorphic rather than just plain strings. Some basic act_as_annotation_value models have been introduced for this. Note: this has affected all methods that take in or work with annotation values. See below for further details.
-
New mixin module:
acts_as_annotation_value. -
New basic annotation value models:
TextValueandNumberValue(but note that you can use any model as a value by specifyingacts_as_annotation_valueon it). -
Removed
Annotation::find_annotatables_with_attribute_name_and_value. -
Removed
Annotation::find_annotatables_with_attribute_names_and_values. -
Removed
with_annotations_with_attribute_name_and_valuein theacts_as_annotatablemodule. -
Annotations::Config::value_restrictionshas been renamed toAnnotations::Config::content_restrictions -
Latest migration version = v3
-
NOTE: the new migration script will keep the old
valuecolumn data in a newold_valuecolumn for EXISTING annotations only. This can be used for verification/text purposes.
-
Added
identifiertoAnnotationAttribute. This can be used to specify what ontology term / URI the attribute can be uniquely identified using. See +AnnotationAttribute#before_validation+ for more information on how this identifier will be generated if not specified manually. -
Changed the
annotationsassociation inact_as_annotation_sourcetoannotations_by, to fix cases when a model has bothacts_as_annotatableANDacts_as_annotation_source. -
Latest migration version = v2
-
Initial import from the BioCatalogue codebase.
-
Improved documentation. See README.rdoc for more info on features and usage.
-
Latest migration version = v1