Method: Sequel::Plugins::SingleTableInheritance::ClassMethods#inherited
- Defined in:
- lib/sequel/plugins/single_table_inheritance.rb
#inherited(subclass) ⇒ Object
Copy the sti_key and sti_dataset to the subclasses, and filter the subclass’s dataset so it is restricted to rows where the key column matches the subclass’s name.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sequel/plugins/single_table_inheritance.rb', line 40 def inherited(subclass) super sk = sti_key sd = sti_dataset subclass.set_dataset(sd.filter(SQL::QualifiedIdentifier.new(table_name, sk)=>subclass.name.to_s), :inherited=>true) subclass.instance_eval do @sti_key = sk @sti_dataset = sd @simple_table = nil end end |