#1133 ✓not-applicable
lmlo

Hooks fail to run with DM 0.10.1 and ExtLib 0.9.13

Reported by lmlo | November 25th, 2009 @ 03:56 PM

Before/after create/save/destroy hooks fail to run as they should. Affected versions appear to be DM 0.10.1 and ExtLib 0.9.13. I have uninstalled all DM-related gems and reinstalled without effect.

1)
NoMethodError in 'Album (instance) should create associated uploads on #save'
undefined method `name' for nil:NilClass
/Library/Ruby/Gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:253:in `execute_after_create_hook_nan_hook_stack'
/Library/Ruby/Gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:300:in `create_hook'
/Library/Ruby/Gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `catch'
/Library/Ruby/Gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `create_hook'
/Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/resource.rb:554:in `save_self'
/Library/Ruby/Gems/1.8/gems/dm-validations-0.10.1/lib/dm-validations.rb:55:in `save_self'
/Library/Ruby/Gems/1.8/gems/dm-core-0.10.1/lib/dm-core/resource.rb:343:in `save'
/Library/Ruby/Gems/1.8/gems/dm-validations-0.10.1/lib/dm-validations.rb:48:in `save'
/Library/Ruby/Gems/1.8/gems/dm-validations-0.10.1/lib/dm-validations/support/context.rb:29:in `validation_context'
/Library/Ruby/Gems/1.8/gems/dm-validations-0.10.1/lib/dm-validations.rb:48:in `save'
./spec/album_spec.rb:37:

Comments and changes to this ticket

  • lmlo

    lmlo November 25th, 2009 @ 03:58 PM

    I'll work on getting a test case shortly.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) November 27th, 2009 @ 02:19 PM

    • State changed from “new” to “unconfirmed”

    @lmlo: were you able to work up a test case for this?

  • lmlo

    lmlo December 21st, 2009 @ 02:24 AM

    I'm working on this again, and it does seem to work with before/after :save hooks, but not create or destroy. HTH

  • lmlo

    lmlo December 21st, 2009 @ 08:47 AM

    Okay it's been hard to create a test case for this, because as soon as I pull the three models in question out of my plugin and into a straight .rb script, the callbacks are fired.

    Any insight would be helpful?

  • lmlo

    lmlo December 21st, 2009 @ 11:28 AM

    The workaround is easy (and ugly) enough, just check for new? inside the before :save hook and at least that way it works.

  • lmlo

    lmlo December 29th, 2009 @ 04:14 PM

    Getting closer to a solution... It looks like I was calling #save! expecting to raise an exception if there were problems, and (now?) by design #save! doesn't run the same hooks as #save does.

    Since this is a legacy (0.9.x) DM codebase I'm updating, I've changed the save calls and my hooks are now running.

    If this is correct behavior, please close this ticket.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 26th, 2010 @ 02:28 AM

    • 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 »

Tags

Pages