On Thu, Oct 21, 2021 at 8:14 PM Jeremy Evans <jeremyeva...@gmail.com> wrote:
> On Thu, Oct 21, 2021 at 7:07 PM s.brimd...@gmail.com < > s.brimdefor...@gmail.com> wrote: > >> Thanks! That did the trick as far as getting typecasting and actually >> inserting bio when creating an instance of the subclass. However, lazy >> loading bio when eager loading the subclass didn't seem to work. I should >> have specified that in my original post but that's really the outcome I >> need: lazy load bio when eager loading the subclass. >> >> Your last post made me try just manually setting @db_schema after adding >> lazy_attributes in the subclass and it seemed to work as I hoped. >> >> class Employee < Sequel::Model >> plugin :class_table_inheritance, key: :kind >> end >> >> class Manager < Employee >> old_schema = @db_schema.dup >> plugin :lazy_attributes, :bio >> @db_schema = old_schema >> end >> >> >> Let me know if you think there's any gotchas you can think of with that >> approach. Otherwise, thank you for your help! >> > > That should be fine. If you don't need lazy_loading in the parent class, > that seems easiest. I think it would be a good idea for lazy_attributes to > keep the db_schema, so you don't even need to reset it manually. I'll see > if I can make that change before the next release. > Committed: https://github.com/jeremyevans/sequel/commit/81713de1a90bd6bf556c5f12b7f9c1a09eadbe6a Thanks, Jeremy > -- 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 sequel-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CADGZSSdQp6cRtb2Noz4MnMvU-HwgYiy0U6CRJpT9Ai_i%2BAAe3A%40mail.gmail.com.