ruby on rails - Saving modified collection of records into instance variable -
i have collection of objects being pulled third party service. using each_with_index block iterate on them , make changes 1 of attributes in each object (payment_due_date__c). i'd have these records saved new instance variable can pass view , iterate on inside table.
@payments.each_with_index |x, i| loan_start_plus = @loan_start_date + i.months x.payment_due_date__c = 3.business_days.before(loan_start_plus) end
how can save updated records collection can pass view?
maybe help:
@payments.each_with_index.map |x, i| loan_start_plus = @loan_start_date + i.months x.payment_due_date__c = 3.business_days.before(loan_start_plus) end
Comments
Post a Comment