0

Rails 2.3 What I've tried...

>> 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
mu is too short
  • 426,620
  • 70
  • 833
  • 800
cluv
  • 620
  • 6
  • 11
  • 1
    Your first try is super wrong, but the next two should work, Can you post the migrations you used to create Subscriptions table? It looks like you have some foreign constraints to keep you from deleting Subscriptions. – Nick Messick May 24 '13 at 20:34

1 Answers1

0

Second try works, just a stupid fk problem.

cluv
  • 620
  • 6
  • 11