#378 ✓resolved
Jox

[Patch] Custom getters get overwritten in inherited models

Reported by Jox | June 13th, 2008 @ 08:44 AM

The Problem:


class Foo
  property :settings, CustomType
  def settings
    @settings ||= {}
  end
end

class Bar < Foo
  ...
end

Bar.new.settings => nil
Foo.new.settings => {}

provided specs with the patch

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 16th, 2008 @ 03:03 AM

    • State changed from “new” to “open”
    • Assigned user changed from “Sam Smoot” to “Dan Kubb (dkubb)”

    Jox, can you try the latest dm-core to see if this is still a problem for you?

    I've moved the code that added the getter/setter so it's only executed when the property is first declared with property() and no longer when the Property object is being created (which happens when a class is inherited. This should've resolved your issue.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 16th, 2008 @ 08:56 AM

    • State changed from “open” to “resolved”

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

Tags

Pages