A Rails integration gem for the Money library, enabling easy handling of currency and monetary values in ActiveRecord and Mongoid models.
Money-Rails is a Ruby gem that integrates the Money library with Ruby on Rails, allowing developers to easily handle monetary values and currencies in their applications. It provides model monetization, currency support, and validation helpers to manage financial data accurately and consistently. The gem simplifies storing, converting, and displaying money within ActiveRecord and Mongoid models.
Ruby on Rails developers building applications that need to handle financial transactions, pricing, or any monetary data. It's particularly useful for e-commerce platforms, fintech apps, or any project requiring robust currency management.
Developers choose Money-Rails because it offers a seamless, Rails-native way to work with money, reducing boilerplate code and potential errors. Its tight integration with ActiveRecord and Mongoid, along with extensive configuration options for currencies and validations, makes it a reliable choice for financial data handling in Rails apps.
Integration of RubyMoney - Money with Rails
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `monetize` macro automatically maps database columns like `price_cents` to Money objects, eliminating manual conversion code in ActiveRecord and Mongoid models.
Supports currency configuration at global, model, attribute, and instance levels, as shown in the README with options like `register_currency` and `with_currency`, ideal for multi-currency apps.
Includes numericality validations for monetized fields with customizable options, such as `greater_than_or_equal_to`, ensuring data integrity without extra validation code.
Provides helpers like `t.monetize` for easy database migrations and RSpec/Minitest matchers (e.g., `monetize`) for streamlined testing of monetized attributes.
Only supports ActiveRecord and Mongoid, excluding other Ruby ORMs like Sequel, which limits adoption in projects with diverse or legacy data layers.
The README notes it's in active development, which can lead to breaking changes or instability, requiring careful version management in production.
Requires initializer setup and deep understanding of the Money gem for advanced features, adding complexity for simple monetary handling needs.