Sha256: c47fc9cd06949d284d1b1972074dd89c86cbb3f54f4e14e4800643fe05bee1a3

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

# Administrate::Field::Carrierwave

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

A plugin to upload and preview Carrierwave attachments in [Administrate].

## Usage

Add it to your `Gemfile`:

```ruby
gem 'administrate-field-carrierwave', '~> 0.1.3'
```

Run:

```bash
$ bundle install
```

Add to your `FooDashboard`:

```ruby
ATTRIBUTE_TYPES = {
  bar: Field::Carrierwave.with_options(image: :standard, multiple: true)
}.freeze
```

To handle multiple asset uploads, the attribute must point to an empty array in a hash:

```ruby
# If multiple: true
def permitted_attributes
  super - [:bar] + [{ bar: [] }]
end
```

### Options

* `image` (default: `nil`): a [version] that will be displayed in an `<img>` element.
* `multiple` (default: `false`): allows uploading of multiple files. **ATTENTION 🚨**: [requires CarrierWave’s `master` branch](https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads). Uploaded files will replace the current ones – if present – and not add to them.

## About

`Administrate::Field::Carrierwave` is maintained by [z.productions].

[Administrate]: https://github.com/thoughtbot/administrate
[version]: https://github.com/carrierwaveuploader/carrierwave#adding-versions
[z.productions]: https://www.z.productions/

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-carrierwave-0.1.3 README.md