On Thu, Oct 21, 2021 at 7:07 PM [email protected] <
[email protected]> 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.

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSf7giuC3EwvjCWTzy1MiZagjbm5QeA45P1rsca_ojfv-Q%40mail.gmail.com.

Reply via email to