ruby - Implement array and iterate -


i have ruby code want use:

if args[:remove_existing_trxs] == 'true'     acquirer.delete_all     company.delete_all     currency.delete_all     adminuser.delete_all     basereseller.delete_all     terminal.delete_all     contract.delete_all     merchant.delete_all     merchantuser.delete_all     paymenttransaction.delete_all   end 

how can define array , iterate?

something that?

[model1, model2].each |model|   model.public_send(:delete_all) end  

or using symbol#to_proc:

[model1, model2].each(&:delete_all) 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -