#330 ✓resolved

STI doesn't work with more properties

Reported by Sherrod | May 31st, 2008 @ 02:59 AM

I don't know if this is a bug, a feature, or just plain unimplemented, but I am doing STI like so:

class Metaphor
  include DataMapper::Resource

  property :id,   Integer, :key => true
  property :x, Integer
  property :type, Discriminator

class Product < Metaphor
  property :name, String, :length => 255, :nullable => false

Then, while in the merb console, I do:

Product.create(:x => 200, :name => 'A Product')

and I get the error:

Sqlite3Error: table metaphors has no column named name

Is this not possible? I was under the impression STI was inheritance as in...inheritance?

Comments and changes to this ticket

  • Aadi Deshpande

    Aadi Deshpande June 9th, 2008 @ 03:07 PM

    I've resolved this in my forked repo.

    git pull git://github.com/cilquirm/dm-core.git

    There's a new spec ( thanks to bernerdschafer ) that tests sti against your adapter ( or sqlite3 ) if you have it.

    I've tested it against sqlite3 and mysql.

  • Bernerd Schaefer

    Bernerd Schaefer June 12th, 2008 @ 09:02 AM

    • State changed from “new” to “resolved”

    This should be fixed, now, as of commit 9e755c7bdae06f7fec433dff31bfe931a9b22874.

    We should be pushing this to a new gem soon.

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