Created
July 29, 2014 17:44
-
-
Save generalzhou/8bb719f91ce46c99a061 to your computer and use it in GitHub Desktop.
Delete supplemental loan doc script for [#75903890]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [#<LoanDocument id: 180, name: "Supplement Form_Jaseboards", file: "Supplement_Form_Jaseboards.pdf", created_at: "2014-07-28 18:44:20", updated_at: "2014-07-28 18:44:20", loan_application_id: "635bbb27-2785-4832-b49c-61b74886e310">, #<LoanDocument id: 111, name: "Benthic Fishing__Supplement", file: "Benthic_Fishing__Supplement.pdf", created_at: "2014-07-09 14:58:00", updated_at: "2014-07-09 14:58:00", loan_application_id: "3fff82e2-5286-4147-8d9a-092551db4088">, #<LoanDocument id: 138, name: "Supplement Form_WhiteOakAuto", file: "Supplement_Form_WhiteOakAuto.pdf", created_at: "2014-07-21 20:01:44", updated_at: "2014-07-21 20:01:44", loan_application_id: "f6a95040-286e-494e-9eed-d79c32747698">, #<LoanDocument id: 113, name: "Giftcardrescue.com__Supplement", file: "Giftcardrescue.com__Supplement.pdf", created_at: "2014-07-09 16:43:04", updated_at: "2014-07-09 16:43:04", loan_application_id: "1395741a-1d9e-44cc-a61c-c1411deae420">, #<LoanDocument id: 142, name: "Supplement Form_Five Star Equity", file: "Supplement_Form_Five_Star_Equity.pdf", created_at: "2014-07-23 16:16:52", updated_at: "2014-07-23 16:16:52", loan_application_id: "c0605629-d7a0-4cd3-a4a4-5966d5029966">, #<LoanDocument id: 89, name: "KHC Advisors LLC__Supplement", file: "KHC_Advisors_LLC__Supplement.pdf", created_at: "2014-07-02 17:03:33", updated_at: "2014-07-02 17:03:33", loan_application_id: "3ccdf549-811a-468f-ae70-60f2d50c40b1">, #<LoanDocument id: 72, name: "Cypress__Supplement", file: "Cypress__Supplement.pdf", created_at: "2014-06-27 16:47:11", updated_at: "2014-06-27 16:47:11", loan_application_id: "8f05ddb3-82f0-4e37-b59a-97081992a2da">, #<LoanDocument id: 140, name: "Supplement Form_Elite Logistics", file: "Supplement_Form_Elite_Logistics.pdf", created_at: "2014-07-21 20:12:26", updated_at: "2014-07-21 20:12:26", loan_application_id: "17473d98-d74c-4d00-9592-39362cb64632">] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ids = %w(635bbb27-2785-4832-b49c-61b74886e310 | |
| c0605629-d7a0-4cd3-a4a4-5966d5029966 | |
| f6a95040-286e-494e-9eed-d79c32747698 | |
| 3fff82e2-5286-4147-8d9a-092551db4088 | |
| 8f05ddb3-82f0-4e37-b59a-97081992a2da | |
| 17473d98-d74c-4d00-9592-39362cb64632 | |
| 3ccdf549-811a-468f-ae70-60f2d50c40b1 | |
| 1395741a-1d9e-44cc-a61c-c1411deae420) | |
| las = LoanApplication.find(ids);nil | |
| las.size | |
| las.each{|l| puts l.loan_documents.size };nil | |
| deleted = las.map do |l| | |
| l.loan_documents.map do |doc| | |
| # comment the delete for a dry run | |
| # doc.delete if doc.name.include?('Supplement') | |
| puts doc.name if doc.name.include?('Supplement') | |
| end | |
| end | |
| las.each{|l| puts l.reload.loan_documents.size };nil | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment