README.md in activefedora-aggregation-0.8.1 vs README.md in activefedora-aggregation-0.9.0
- old
+ new
@@ -13,32 +13,33 @@
class GenericFile < ActiveFedora::Base
end
generic_file1 = GenericFile.create(id: 'file1')
generic_file2 = GenericFile.create(id: 'file2')
-generic_file3 = GenericFile.create(id: 'file2')
+generic_file3 = GenericFile.create(id: 'file3')
class Image < ActiveFedora::Base
ordered_aggregation :generic_files, through: :list_source
end
image = Image.create(id: 'my_image')
image.ordered_generic_file_proxies.append_target generic_file2
image.ordered_generic_file_proxies.append_target generic_file1
image.save
-image.generic_files # => [generic_file2, generic_file]
-image.ordered_generic_files # => [generic_file2, generic_file]
+image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
+image.ordered_generic_files.to_a # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
# Not all generic files must be ordered.
image.generic_files += [generic_file3]
-image.generic_files # => [generic_file2, generic_file, generic_file3]
-image.ordered_generic_files # => [generic_file2, generic_file]
+image.generic_files => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
+image.ordered_generic_files.to_a => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
# non-ordered accessor is not ordered.
-image.ordered_generic_file_proxies.insert_at(0, generic_file3)
-image.generic_files # => [generic_file2, generic_file, generic_file3]
-image.ordered_generic_files # => [generic_file3, generic_file2, generic_file]
+image.ordered_generic_file_proxies.insert_target_at(0, generic_file3)
+image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
+image.ordered_generic_files.to_a # => [#<GenericFile id: "file3">, #<GenericFile id: "file2">, #<GenericFile id: "file1">]
# Deletions
-image.ordered_generic_file_proxies.delete_at(1)
-image.ordered_generic_files # => [generic_file3, generic_file]
+image.ordered_generic_file_proxies.delete_at(1) => #<GenericFile id: "file2">
+image.ordered_generic_files.to_a # => [#<GenericFile id: "file3">, #<GenericFile id: "file1">]
+image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
```