Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minting-rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minting-rails

  • 0.3.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Minting::Rails

Minting::Rails is a gem that provides money attributes to ActiveRecord models. It integrates the Minting library into your Rails application.

Installation

Add this line to your application's Gemfile:

gem 'minting-rails'

And then execute:

  bundle

Configuration

After intalling generate Minting configuration initializer:

rails g mint:initializer

You can configure the default currency for your application by adding the following line to your config/initializers/minting.rb:

Minting.configure do |config|
  config.default_currency = :usd
end

Usage

To use Minting::Rails, you add the money_attribute method to your ActiveRecord models. For example:

class SimpleOffer < ApplicationRecord
  money_attribute :price, currency: 'USD'
  money_attribute :discount, currency: 'USD'
end

Now you can use the price attribute as a Money object:

product = Product.ne(price: 100)
puts product.price # => "$100.00"

To do

  • API Documentation
  • Internationalization
  • Publish 1.0 Beta

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 27 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc