Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
elrayle opened this issue Dec 18, 2015 · 6 comments
Closed

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

elrayle opened this issue Dec 18, 2015 · 6 comments
Assignees

Comments

@elrayle
Copy link
Contributor

elrayle commented Dec 18, 2015

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
Copy link
Member

jcoyne commented Jan 20, 2016

did you try in_objects?

@roryegerton
Copy link

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
Copy link
Member

mjgiarlo commented Feb 4, 2016

@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
Copy link
Member

mjgiarlo commented Feb 5, 2016

@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
Copy link

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

ordered_members << fileset

And works fine

@mjgiarlo
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants