Hello,
I was working my way through implementing the single table inheritance
plugin
<https://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/SingleTableInheritance.html>
and
I think I found a few typos in the documentation.
I found that using *key_map:* instead of *model_map:* properly maps the
class to the type column. (I'm not sure how it's supposed to be
implemented, but *model_map:* sounds like it should be the appropriate
option name for this.)
Additionally, I found that I had to swap the direction of the map hashes
for the plugin to work correctly. For example, the map should look like
this instead: *{:Staff => 1, :Manager => 2}*
Using the example in the docs, I found that the following changes need to
be made to get it working correctly:
Doc example:
*Employee.plugin :single_table_inheritance, :type, model_map: {1=>:Staff,
2=>:Manager}*
How I got it to work:
*Employee.plugin :single_table_inheritance, :type, key_map: {:Staff =>
1, :Manager => 2}*
I just wanted to share my findings and confirm that I'm using the plugin
correctly.
Thanks!
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/ac605c36-b5d2-42c5-a735-9fa3dcdcbb95n%40googlegroups.com.