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

After deleting an ordered_member object, getting errors in the parent object #196

Closed
ojlyytinen opened this issue Nov 9, 2015 · 3 comments

Comments

@ojlyytinen
Copy link

If I destroy an object that's in ordered_members of another, then that seems to break the parent object. I'm using v0.3.1.

parent = Hydra::PCDM::Object.create
child = Hydra::PCDM::Object.create
parent.ordered_members << child
parent.save
child.destroy
parent.reload
parent.save
NoMethodError: undefined method `pcdm_object?' for #<ActiveTriples::Resource:0x000000059bfc80>
    from /home/######/.rvm/gems/ruby-2.2.1/gems/rdf-1.99.0/lib/rdf/mixin/enumerable.rb:724:in `method_missing'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/rdf-1.99.0/lib/rdf/mixin/mutable.rb:181:in `method_missing'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb:43:in `select'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb:43:in `ordered_objects'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb:47:in `ordered_object_ids'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/object_indexer.rb:8:in `block in generate_solr_document'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/object_indexer.rb:4:in `tap'
    from /home/######/.rvm/gems/ruby-2.2.1/bundler/gems/hydra-pcdm-2b43e91ca293/lib/hydra/pcdm/object_indexer.rb:4:in `generate_solr_document'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/active-fedora-9.6.1/lib/active_fedora/indexing.rb:23:in `to_solr'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/active-fedora-9.6.1/lib/active_fedora/indexing.rb:32:in `update_index'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/active-fedora-9.6.1/lib/active_fedora/indexing.rb:61:in `update_record'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/active-fedora-9.6.1/lib/active_fedora/callbacks.rb:243:in `block (2 levels) in update_record'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
... 24 levels...
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/commands/rails.rb:6:in `call'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/command_wrapper.rb:38:in `call'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:183:in `block in serve'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:156:in `fork'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:156:in `serve'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:131:in `block in run'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `loop'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `run'
    from /home/######/.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /home/######/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/######/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
@jcoyne
Copy link
Member

jcoyne commented Nov 9, 2015

This is related to samvera-deprecated/activefedora-aggregation#72 somewhat.

@val99erie
Copy link

A possible hint. (I'm not sure if my bug is the same problem as this issue)

In heliotrope (a curation_concerns based Rails app), when I delete the representative FileSet from a GenericWork, there is a callback that is supposed to remove the representative relationship from the parent GenericWork.

It does that by looping through all the parent works and updating them, but I've noticed that when I delete the FileSet, it never enters the loop because the list of parent works is (incorrectly) empty:
https://github.com/projecthydra-labs/curation_concerns/blob/master/curation_concerns-models/app/models/concerns/curation_concerns/file_set/belongs_to_works.rb#L40

It's using the hydra-pcdm in_objects method to find the list of parent works:
https://github.com/projecthydra-labs/curation_concerns/blob/master/curation_concerns-models/app/models/concerns/curation_concerns/file_set/belongs_to_works.rb#L11

@jrgriffiniii
Copy link
Contributor

mlibrary/heliotrope#116 (comment) seems to confirm that this was fixed, and samvera-deprecated/activefedora-aggregation#72 seems to have been resolved with updates to CurationConcerns (pulibrary/plum#249)

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