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

Work generic_file validation is wrong #71

Closed
jcoyne opened this issue May 11, 2015 · 8 comments
Closed

Work generic_file validation is wrong #71

jcoyne opened this issue May 11, 2015 · 8 comments
Assignees
Labels

Comments

@jcoyne
Copy link
Member

jcoyne commented May 11, 2015

https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/models/concerns/work_behavior.rb#L41-L42

it is validating that the type of file must be a Works::GenericFile however Sufia will want to provide a "GenericFile" which does not satisfy the current validation:

     ArgumentError:
       each file must be a Hydra::Works::GenericFile
@jcoyne jcoyne added the bug label May 11, 2015
@jcoyne jcoyne added this to the May Hydra PCDM milestone May 11, 2015
@jcoyne
Copy link
Member Author

jcoyne commented May 11, 2015

@jcoyne jcoyne added the ready label May 11, 2015
@jcoyne jcoyne self-assigned this May 11, 2015
@jcoyne
Copy link
Member Author

jcoyne commented May 11, 2015

Blocked by #72

@jcoyne jcoyne added the Blocked label May 11, 2015
@elrayle
Copy link
Contributor

elrayle commented May 11, 2015

I have a fix for this specific problem. I will create a PR.

@elrayle
Copy link
Contributor

elrayle commented May 12, 2015

PR #74 fixes this issue. When the PR is merged, this ticket should be closed.

@elrayle
Copy link
Contributor

elrayle commented May 12, 2015

To validate something is a generic file...

raise ArgumentError, "parent_generic_file must be a works generic file" unless Hydra::Works.generic_file? parent_generic_file

@elrayle elrayle added in progress and removed ready labels May 12, 2015
@elrayle elrayle assigned elrayle and unassigned jcoyne May 12, 2015
@elrayle
Copy link
Contributor

elrayle commented May 12, 2015

Ok, with the fuller set of tests, it is apparent the kludge does not work. By using initialize method, it is not fully using the included PCDM:CollectionBehavior. It does not seem to create the members container in Fedora. The most common error:

NoMethodError:
       undefined method `container' for []:ActiveFedora::Associations::ContainerProxy

@kevinreiss
Copy link
Contributor

Why do we want to use:

all_members = self.members.container.to_a

instead of just:

all_members = self.members.to_a

https://github.com/projecthydra-labs/hydra-works/blob/validations/lib/hydra/works/models/concerns/collection_behavior.rb#L44

hydra-pcdm doesn't seem to use .container. It is just doing this as a single line https://github.com/projecthydra-labs/hydra-pcdm/blob/master/lib/hydra/pcdm/models/concerns/collection_behavior.rb#L63-L65.

@elrayle
Copy link
Contributor

elrayle commented May 15, 2015

Fixed by PR samvera/hydra-pcdm#85

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

No branches or pull requests

4 participants