#759 ✓resolved
Star Trader

Hook's don't respect STI inheritance model

Reported by Star Trader | January 8th, 2009 @ 07:54 PM

For the following code:

class Person
  include DataMapper::Resource
  property :id,        Serial
  property :name,      String, :nullable => false
  property :type, Discriminator
end

class Man < Person
  before :valid? do
    name ||= "Anonymous Guy"
  end
end

class Woman < Person
  before :valid? do
    name ||= "Anonymous Gal"
  end
end

Given the above, one of the before hooks will not run. It seems that one hook is getting overridden by the other to spite being in different classes

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

Attachments

Pages