Is there a way to get the case statement at the bottom to work?  The problem is that if e.type == EventOne (for example) is true, e.type === EventOne is false and the case fails to find a match.

class PlayItem
  include DataMapper::Resource

  property :id,       Integer, :key => true
  property :event_id, Integer, :nullable => false
  property :name,     Text

  belongs_to, :event
end

class Event
  include DataMapper::Resource

  property :id,   Integer, :key => true
  property :type, Discriminator
  property :name, Text

  has n, :play_items
end

class EventOne < Event
end

class EventTwo < Event
end

e = PlayItem.first.event

case e.type
when EventOne
  puts 'One'
when EventTwo
  puts 'Two'
else
  puts "Unknown event type #{e.type}"
end



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to