I'm trying to delete an account but at the same time i'd like to delete the portals that belongs to the account. This is what i wrote but it's not working. how can i deal with this problem?
I have this code inside the account controller in the "destroy" method def destroy @account = Account.find(params[:id]) @portal = Portal.find(:all, :conditions => ['account_id = ?', @account.id ]) @portal.destroy @account.destroy end any ideas?
the error displays this:
NoMethodError in AccountsController#destroy
undefined method `destroy' for #<Array:0x47982a0> app/controllers/accounts_controller.rb:78:in `destroy' Request
Parameters:
{"_method"=>"delete", "authenticity_token"=>"f8c32ed76159e1b51b0883ef72a4ab801b92d322", "id"=>"11"}