#380 ✓resolved
David Perkowski

Discriminator-typed columns do not get set properly

Reported by David Perkowski | June 13th, 2008 @ 01:05 PM

I have an STI hierarchy, and my property of type Discriminator is not getting set to the name of the class. Instead it's being set to an empty string.

Neither RootClass.create(attributes) or DerivedClass.create(attributes) results in a record containing a proper discriminator value.

(Manipulating DM through the Merb console)

Comments and changes to this ticket

  • David Perkowski

    David Perkowski June 13th, 2008 @ 01:06 PM

    • Title changed from “Discriminator column type does not get set properly” to “Discriminator-typed columns do not get set properly”
  • Bernerd Schaefer

    Bernerd Schaefer June 13th, 2008 @ 03:01 PM

    • State changed from “new” to “open”
    • Assigned user changed from “Sam Smoot” to “Bernerd Schaefer”
  • Bernerd Schaefer

    Bernerd Schaefer June 13th, 2008 @ 04:04 PM

    Could you take a look at http://github.com/sam/dm-core/tr... and tell me if the spec addresses your problem? It seems like it does, which means that this bug is fixed on edge.

    Lines 75-107 define the models, 271-287 create some records, and 296-312 test their types.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 13th, 2008 @ 04:35 PM

    • Milestone cleared.
    • Assigned user changed from “Bernerd Schaefer” to “Dan Kubb (dkubb)”

    I have successfully reproduced this and am about to commit a fix/specs to edge.

  • David Perkowski

    David Perkowski June 13th, 2008 @ 04:39 PM

    • Assigned user changed from “Dan Kubb (dkubb)” to “Bernerd Schaefer”

    It certainly looks like those specs address my problem, but I just did 'sake dm:gems:refresh', and the discriminator column is still not being set.

    So I just created a new app with merb-gen and tested the behavior there, and it seems to work fine! But my app, no love. So I started sticking stuff into the new app gradually and lo and behold, all I had to do to break it was put:

    dependency 'dm-validations', '>=0.9.2'

    into my init.rb. This, by itself, with no validations actually used in any models, causes this problem to manifest.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 13th, 2008 @ 04:44 PM

    • State changed from “open” to “resolved”
    • Assigned user changed from “Bernerd Schaefer” to “Dan Kubb (dkubb)”

    This was fixed with the following commit:

    http://github.com/sam/dm-core/co...

    David confirmed that it was resolved.

  • David Perkowski

    David Perkowski June 13th, 2008 @ 04:45 PM

    • Assigned user changed from “Dan Kubb (dkubb)” to “Bernerd Schaefer”

    OK, this is working for me now. Thanks Dan!

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

Tags

Pages