On Tuesday, July 9, 2019 at 5:05:08 AM UTC-7, Artem Kondratev wrote: > > We are using subclassed plugin to have different classes (let's say that > each of them represents bank account type in different countries) with one > underlying table. Bank account types can be identified with a X field in > the table. > > So when you get the request from a client you need to find bank account > record in the table and create instance of a needed class. > > Naive solutions is to just use a parent class, fetch the data, get the X > field's value and the fetch the data again using the class X field > represents. But that's two requests to DB, which is, while not bad, but > still x2 times more reads. > > One option I can think of is to have something like > https://apidock.com/rails/ActiveRecord/Persistence/becomes. > > Like this: > > bc = BankAccountCanada.call(BankAccount[1].values) > > Sequel's source code however says that 'It probably should not be used by > external code". Which is sort of expected. > > So - scary this can get? Any other options (except for polymorphic plugin) >
That usage is should be fine. The Model.call API is not going to change. 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/4315549a-20fb-49fa-8940-0644d384eefb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
