class Company1 < Sequel::Model( :companies1 ) before_create do set( :time_created => Time.now ) end before_destroy do Employee1.where( :company_id => pk ).destroy end end class Employee1 < Sequel::Model( :employees1 ) validates_length_of :name, :minimum => 8 end class Company2 < Sequel::Model( :companies2 ) end class Employee2 < Sequel::Model( :employees2 ) end class Author1 < Sequel::Model( :authors1 ) def posts Post1.where( :author_id => pk ) end def update_post_count post_count = posts.size save end end class Post1 < Sequel::Model( :posts1 ) def author Author1[ author_id ] end after_destroy do author.update_post_count end end class Author2 < Sequel::Model( :authors2 ) def posts Post2.where( :author_id => pk ) end end class Post2 < Sequel::Model( :posts2 ) def author Author2[ author_id ] end end