#1139 ✓not-applicable
sankar

Datamapper Relationship Chain error

Reported by sankar | December 1st, 2009 @ 04:27 AM

I got the following error while updating data. please see the attachment for my sample code

/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:302:in save_resource': undefined methodattach_parent' for #<DataMapper::Associations::RelationshipChain:0xb7751fa4> (NoMethodError)

    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:172:in `with_repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/support/kernel.rb:6:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core.rb:181:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/repository.rb:44:in `scope'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core.rb:181:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/support/kernel.rb:6:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:172:in `with_repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:298:in `save_resource'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:210:in `save'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:452:in `each'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:452:in `each'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:309:in `send'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:309:in `method_missing'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:210:in `save'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `each'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:299:in `save'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `catch'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `save'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:303:in `save_resource'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:172:in `with_repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/support/kernel.rb:6:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core.rb:181:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/repository.rb:44:in `scope'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core.rb:181:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/support/kernel.rb:6:in `repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:172:in `with_repository'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:298:in `save_resource'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:210:in `save'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:452:in `each'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:452:in `each'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:309:in `send'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:309:in `method_missing'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:210:in `save'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `each'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:299:in `save'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `catch'
    from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `save'
    from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:538:in `update_attributes'
    from sample_datamapper.rb:75

shell returned 1

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 1st, 2009 @ 03:40 PM

    • State changed from “new” to “unconfirmed”

    @sankar: Can you try upgrading to DM 0.10.1 and let me know if the problem persists? All of the code related to the bug you are reporting was rewritten to resolve this problem (among others).

  • sankar

    sankar December 1st, 2009 @ 11:56 PM

    it works fine in version 0.10.1, but i have used dm-sweatshop for fixtures, i got undefined method error cattr_accessor' in<br/> dm-sweatshop/lib/dm-sweatshop/unique.rb line no: 66

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2009 @ 12:42 PM

    @sankar: what version of extlib do you have? Can you make sure you've got the latest version (0.9.13) installed? Are you able to require 'extlib/class'? Can you try explicitly requiring it before requiring dm-sweatshop?

    The extlib package adds cattr_accessor to the Class object. I'm not sure why it's not happening in this case.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2009 @ 12:43 PM

    @sankar: If you try all of the above and it still doesn't work, can you update your sample script with some code that reproduces the error for you everytime?

  • sankar

    sankar December 3rd, 2009 @ 12:38 AM

    @dkubb: sorry, the error is not in sample code, it is my application, I didn't put require 'extlib/class' in my application. i'm not aware of that. thnaks for your help. it works fine now

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 3rd, 2009 @ 05:21 PM

    • State changed from “unconfirmed” to “not-applicable”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Attachments

Pages