Sha256: dab6e919063c9146c102d58ac8c0ab55005f916f7098e5aa0dc6ddf9fe9ff04b

Contents?: true

Size: 1.03 KB

Versions: 1

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.4'
```

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

1 entries across 1 versions & 1 rubygems

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