-
Add
Annotation::include_values
as a named scope that can be used to potentially improve performance. -
Added
include_values
optional 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
value
object 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_adjustments
code in theAnnotation
model 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_fu
nows allows reloading of the versioned columns (needed if doing something during a migration).
-
acts_as_annotatable
now requires you to specify an option -:name_field
- on the model that is becoming an annotatable. -
acts_as_annotatable
now exposes anis_annotatable
attribute to allow you to check if a model can act as an annotatable.
-
Updated the routes to allow
requirements
to 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:
TextValue
andNumberValue
(but note that you can use any model as a value by specifyingacts_as_annotation_value
on 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_value
in theacts_as_annotatable
module. -
Annotations::Config::value_restrictions
has been renamed toAnnotations::Config::content_restrictions
-
Latest migration version = v3
-
NOTE: the new migration script will keep the old
value
column data in a newold_value
column for EXISTING annotations only. This can be used for verification/text purposes.
-
Added
identifier
toAnnotationAttribute
. 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
annotations
association inact_as_annotation_source
toannotations_by
, to fix cases when a model has bothacts_as_annotatable
ANDacts_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