byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
437 stars 57 forks source link

Persist default values of aliased attributes #96

Open jonathanhefner opened 1 year ago

jonathanhefner commented 1 year ago

1f150f6bc3194f803b15c400513f07aacf53939b made it so that default values are always persisted. This commit adds support for aliased attributes to that change.

byroot commented 1 year ago

I considered this but wasn't expecting anyone to use aliased attributes in this case.

Is this something you are doing?

jonathanhefner commented 1 year ago

Is this something you are doing?

No, I just wanted to make sure all the cases were covered. :smile: I wasn't sure how much aliased attributes were used at Shopify. But if they are explicitly not supported, I think it's fine.

byroot commented 1 year ago

But if they are explicitly not supported, I think it's fine.

Yeah, I don't really see a use case for it to be honest. That said I initially took that decision in #94 because it was in much more of a hot path, it probably wouldn't matter here. We could also cache (or precompute) that array on the class.