I am applying group by on active records and then do each to access the records from hash.
Following is my code
invoice_transactions.group_by(&:pay