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

HasAndBelongsToManyAssociation#delete_records assumes the inverse is a HABTM #763

Closed
jcoyne opened this issue Apr 8, 2015 · 0 comments
Closed

Comments

@jcoyne
Copy link
Member

jcoyne commented Apr 8, 2015

If the inverse is a has_many you get an error like this:

    ActiveFedora::UnknownAttributeError:
       TimeSpan does not have an attribute `created_ids'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/attributes.rb:96:in `array_reader'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/attributes.rb:52:in `[]'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/has_and_belongs_to_many_association.rb:84:in `block in delete_records'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/has_and_belongs_to_many_association.rb:79:in `each'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/has_and_belongs_to_many_association.rb:79:in `delete_records'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/collection_association.rb:372:in `delete_or_destroy'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/collection_association.rb:212:in `destroy'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/associations/collection_proxy.rb:641:in `destroy'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:273:in `block in save_collection_association'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:267:in `each'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:267:in `save_collection_association'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:138:in `block in add_autosave_association_callbacks'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:108:in `instance_eval'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/autosave_association.rb:108:in `block in define_non_cyclic_method'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `call'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `block in call'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `each'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_update_callbacks'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/callbacks.rb:242:in `update_record'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/persistence.rb:144:in `create_or_update'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/persistence.rb:27:in `save'
     # /Users/justin/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bundler/gems/active_fedora-86a70dbe6385/lib/active_fedora/validations.rb:50:in `save'
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

1 participant