Let's say we have a class

class BankAccount < Sequel::Model do
  plugin :subclasses

end

And it's subclass

class BankAccountSub < BankAccount
end

If we are going to call it's methods like

BankAccountSub.all

We are going to get all BankAccounts.
To get only BankAccountSubs (we are assuming we can BankAccountSubs should 
not have `attr` attribute (=nil)
One possible solution is to override method like this (in this case we will 
get all 

class BankAccountSub < BankAccount
  def self.all
    exclude(attr: nil)
  end
end

This will work fine, but overriding all of the methods is too much work and 
it is always possible to miss something.

So the question is - is there any way to create Subclassed the way that all 
class methods take into account this `attr`'s value?

-- 
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/60b5b34c-27bc-4aea-807b-47dcf50bed59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to