samvera / hydra-works

A ruby gem implementation of the PCDM Works domain model based on the Samvera software stack
Other
24 stars 14 forks source link

file set does not appear to have a way to get to it's work #258

Closed elrayle closed 8 years ago

elrayle commented 8 years ago

To reproduce...

wrk = Hydra::Works::Work.new(id: 'w-1')
fs = Hydra::Works::FileSet.new(id: 'fs-1')

wrk.members << fs
=> [#<Hydra::Works::FileSet id: "fs-1", head: [], tail: []>]

fs.in_work   => NoMethodError: undefined method `in_work'
fs.in_works => []

If the model defines that a file set can belong to one and only one work, then the method in_work should return the work wrk. If a file set can belong to multiple works, then method in_works should return all works that have the file set fs as a member.

jcoyne commented 8 years ago

did you try in_objects?

roryegerton commented 8 years ago

Hi Folks, Just wondering if any update on this....We are assigning a fileset into a work

wrk.members << fs fs.in_works => [] fs.in_objects => [] fs.in_objects? => undefined method `in_objects?'

I notice the following comment in the Dive into Hydra tutorial Lesson 6: create instances of hydra works models bf.in_works ### TODO in_works returns []

mjgiarlo commented 8 years ago

@roryegerton No, I don't believe this is an update on this. Instead of appending to members, can you use ordered_members in the meantime?

cc: @jcoyne @tpendragon @elrayle the issue here is that in_objects (in hydra-pcdm) uses ordered_by (from activefedora-aggregation).

mjgiarlo commented 8 years ago

@roryegerton This is now resolved in the underlying hydra-pcdm gem, and will be resolved in hydra-works when it picks up the next release of hydra-pcdm. Thanks for the reminder!

roryegerton commented 8 years ago

Hi Folks, thanks a million for this. We did:

ordered_members << fileset

And works fine

mjgiarlo commented 8 years ago

Cool, @roryegerton. If you don't need ordering among the members, you may now also use members.<< since the bug was fixed. Glad to hear you've got a working solution.