#753 ✓resolved
Postmodern

When including DataMapper::Resource twice, it over-rides previous properties

Reported by Postmodern | January 7th, 2009 @ 07:38 PM

In my DataMapper projects I usually have a main Model modules, which includes DataMapper::Resource and sets up various common properties. Additionally, I have other mixins that add properties to my Models. As a safety measure I always include Model into my other mixins.

I discovered that when including multiple mixins, not all the properties showed up in the model. Dan Kubb tracked the problem down to including DataMapper::Resource multiple times. Each time it is included, it will erase previously defined properties, instead of aggregating them together.

Here is a trivial example: http://gist.github.com/44525

Included is a ./bug.rb script which will repeat the bug and print some debugging messages.

The trivial example should print out the PropertySet of the Person model (type, id, address, email). But the 'address' property is not present, even though the HasAddress module is included into Person.

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 »

Pages