Great, thank you!

On Tuesday, October 26, 2021 at 12:44:41 PM UTC-7 Jeremy Evans wrote:

> On Thu, Oct 21, 2021 at 8:14 PM Jeremy Evans <[email protected]> wrote:
>
>> 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.
>>
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/42031a7f-4566-4738-a7d2-82a72d3af78an%40googlegroups.com.

Reply via email to