#278 ✓resolved
Guillaume Maury (giom)

[PATCH]Hooks and STI

Reported by Guillaume Maury (giom) | May 13th, 2008 @ 04:39 AM

When you add a before hook in a superclass, it doesn't work in the super class.

For example

class User
  include DataMapper::Resource 
  property :type, Class, :default => lambda {|*args| args[0].class.to_s}

  before :save, :do_something

  def do_something
    puts "hello"

class Member < User
  def do_something
    puts "member"

=> true
undefined method `call' for nil:NilClass
/Users/hiorin/git/dm-core/lib/data_mapper/hook.rb:111:in `a_class_method'

The patch included solves this problem and adds two badly named spec to check it...

You can also pull it with git pull git://github.com/giom/dm-core.git hooks

Comments and changes to this ticket

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