0
레일 2.3 나는 무엇을 시도했다 ...문제는 외래 키 제약 조건은
>> Import::Subscription.all(:conditions => ["account_id = ?", "44"]).destroy_all
NoMethodError: undefined method 'destroy_all' for #<Array:0x106ab4d78>
>> Import::Subscription.all(:conditions => ["account_id = ?", "44"])
>> @subs = _
>> @subs.each { |s| s.destroy }
ActiveRecord::StatementInvalid: Mysql::Error: Cannot delete or update a parent row: a
foreign key constraint fails
@subs[0].delete
ActiveRecord::StatementInvalid: Mysql::Error: Cannot delete or update a parent row: a
foreign key constraint fails
첫 번째 시도가 잘못되었지만 다음 두 가지가 작동해야합니다. 구독 테이블을 만드는 데 사용한 마이그레이션을 게시 할 수 있습니까? 구독을 삭제하지 못하도록하는 외적인 제약이있는 것 같습니다. – messick