Think I found a bug with this: it doesn't qualify subclasses of subclasses as table_name will return the alias when subclassing a subclass. Checking cti_table_name rather than table_name works, but I believe it is slightly different functionality in that it will inherit the qualifier from the closest subclass and not from the base class. I think that probably fits what one would expect to happen though.
i.e.: class Album < Sequel::Model(Sequel.qualify(:charts, :albums)) plugin :class_table_inheritance, key: :type, qualify_tables: true end class SoldAlbum < Album # <- will use charts.sold_albums end class PlatinumAlbum < SoldAlbum # <- will try to use albums (the subquery alias) rather than charts.platinum_albums end Any issue w/ using cti_table_name? Patch w/ spec: https://gist.github.com/benalavi/884a3eb7d7497c0114610e3c76faf2ef -- if this looks good will submit a PR On Tuesday, November 20, 2018 at 5:11:00 PM UTC-8, Ben Alavi wrote: > > Good point! Fixed and submitted PR, thanks for reviewing so quickly > > On Tue, Nov 20, 2018 at 5:00 PM Jeremy Evans <[email protected]> > wrote: > >> On Tuesday, November 20, 2018 at 4:30:23 PM UTC-8, Ben Alavi wrote: >>> >>> Patch that would take a new :qualify_tables option to the CTI plugin: >>> >>> https://gist.github.com/benalavi/159110fd58907c7925fc8bd1958e3ad2 >>> >>> So the API would be: >>> >>> plugin :class_table_inheritance, qualify_tables: true >>> >> >> This looks good. Note that you do not need to freeze the newly added >> attribute, true/false is always considered frozen. >> >> Thanks, >> Jeremy >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "sequel-talk" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/sequel-talk/Tikx3GRUVMU/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/sequel-talk. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
