Hello all,
Have been playing with the class table inheritance plugin and am getting
some unexpected results. Here's a simplified version of my schema:
create_table :messages do
primary_key :id
varchar :kind, :size => 40, :null => false, :index => true
text :body
end
create_table :phone_calls do
foreign_key :id, :messages, :key => :id, :delete => :cascade,
:primary_key => true
DateTime :called_at, :timezone => false
end
And my classes snippet:
class Message
plugin :class_table_inheritance, :key => :kind
# have also tried adding :table_map => { :Message =>
:messages, :PhoneCall => :phone_calls} to the above, to no avail
end
class PhoneCall < Message
end
I seeded my Postgres db with data that looks like this (portions removed
for brevity):
Messages:
id | kind
----+-----------
1 | Message
2 | Message
3 | Message
4 | PhoneCall
PhoneCall:
id
----
4
Based upon the documented example, my expectation was that running
Message.all would yield:
# [ <#Message>, <#Message>, <#Message>, <#PhoneCall>]
However I'm instead receiving:
# [ <#Message>, <#Message>, <#Message>, <#Message>]
So attempts to call methods defined only on the PhoneCall class (i.e. when
rendering the collection) lead to 'undefined method' errors.
Any insight on where I might be going wrong would be appreciated. As
always, thanks for the help!
--Chad
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/VajwN9zWeDUJ.
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/sequel-talk?hl=en.