Delete data from 2 different models

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 = ?’, ])
any ideas?

the error displays this:

NoMethodError in AccountsController#destroy

undefined method destroy' for #<Array:0x47982a0> app/controllers/accounts_controller.rb:78:indestroy’



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs