0

Rails 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
4

1 に答える 1

0

2回目の試行は機能しますが、愚かなfkの問題です。

于 2013-05-24T21:02:56.360 に答える