Sha256: 92a5e917cbf9813398538d818c69c3d7f75405b35b5b2dd8807d2668130f15f0

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# Administrate::Field::Money

[![Code Climate](https://codeclimate.com/github/zooppa/administrate-field-money/badges/gpa.svg)](https://codeclimate.com/github/zooppa/administrate-field-money)

A plugin to deal with money in [Administrate], with the help of [Money] gem.

**Attribute must be in cents**.

![Demo](https://raw.githubusercontent.com/zooppa/administrate-field-money/master/demo.gif)

## Usage

Add it to your `Gemfile`:

```ruby
gem 'administrate-field-money', '~> 0.0.5'
```

Run:

```bash
$ bundle install
```

Add to your `FooDashboard`:

```ruby
ATTRIBUTE_TYPES = {
  bar: Field::Money.with_options(
    unit: 'USD', # EUR, CAD, GBP, AUD, JPY, ...
    symbol: '$',
    delimiter: ',',
    separator: '.'
  ),
}.freeze
```
The field will figure out the appropriate thousand separator and decimal delimiter for the unit.

## About

Administrate::Field::Money is maintained by [z.productions].

[Administrate]: https://github.com/thoughtbot/administrate
[Money]: https://github.com/RubyMoney/money
[z.productions]: https://www.z.productions/

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administrate-field-money-0.0.6 README.md
administrate-field-money-0.0.5 README.md