money-rails icon indicating copy to clipboard operation
money-rails copied to clipboard

Add Money.with_bank for Dynamic Currency Stores

Open pranavbabu opened this issue 10 months ago • 0 comments

This PR introduces the Money.with_bank method, allowing developers to assign different currency stores (banks) dynamically within a scoped block. This is particularly useful for loading custom exchange rates per user session.

Key Changes

  • Implemented Money.with_bank(bank_instance), enabling temporary overrides of the default bank.
  • Ensures thread safety by restoring the original bank after execution.
  • Added documentation and an example demonstrating its usage in a Rails controller with around_action.

pranavbabu avatar Feb 25 '25 15:02 pranavbabu