activerecord - Is there a way to delete the children table in multiple polymorphic relationship rails? -


for example, have 3 models right now. credential, record , item.

class credential < activerecord::base   has_many :records, dependent: :destroy end  class record < activerecord::base   belongs_to :syncable, polymorphic: true end  class item < activerecord::base   has_one :records, as: :syncable, dependent: :destroy end 

let's say, in credential controller, there destroy method:

def destroy   @credential.destroy end 

this can delete data in credential , record table not item table. there way delete data in item table when delete data in credential table , record table?


Comments