Sha256: 7afb7b8f52cf3bf6b12dcc9946c53b50eac44b85ac568e6f883fb3c848ff5592

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

# Administrate::Field::Money

[![Build Status](https://travis-ci.com/zooppa/administrate-field-money.svg?branch=master)](https://travis-ci.com/zooppa/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.

**IMPORTANT: this plugin expects the attribute to be an integer representing the
number of cents, with a name ending in `_cents`**.

## Usage

Add it to your `Gemfile`:

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

Run:

```bash
$ bundle install
```

Add to your `FooDashboard`:

```ruby
ATTRIBUTE_TYPES = {
  amount_cents: Field::Money.with_options(
    code: '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.

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

## About

Administrate::Field::Money is maintained by [Zooppa].

See also the list of [contributors](https://github.com/zooppa/administrate-field-money/contributors) who participated in this project.

[administrate]: https://github.com/thoughtbot/administrate
[money]: https://github.com/RubyMoney/money
[zooppa]: https://www.zooppa.com/

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-money-0.2.1 README.md