Sha256: e0d1e7030b0843d7f691a706552ee563fa7c43c31475762593970c72d72f3ca6

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

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.1 README.md