Skip to content

Feature request: allow option "overwrite: true" for mount_uploader #200

@bblack

Description

@bblack

We're using redactor-rails (which is years out of date at this point). That lib provides some facility for a fancy text editor, to which a user can supply attachments like inline pictures. The lib provides an out-of-the-box base class for models backed by mongoid (an ORM for MongoDB), which will upload those attachments using carrierwave, and store the resulting URL on that model record.

That base class, on inclusion into the application's actual model classes, defines several fields:

https://github.com/SammyLin/redactor-rails/blob/3dc460d9f2b84625219349a811cca7c33549fad0/lib/redactor-rails/orm/mongoid.rb#L19

An effect of this is that, if we then call carrierwave-mongoid's mount_uploader, one of two things will happen:

  1. If that call includes :mount_on => :data_file_name, which is the name of the field that redactor-rails already defined, then a warning is produced.
  2. Otherwise, the field that redactor-rails defined ends up being useless.

Certainly carrierwave-mongoid cannot (and should not) do anything about effect 2. And although carrierwave-mongoid should not (per se) do anything to prevent effect 1, it would be nice to offer the caller the choice to suppress it. For example:

mount_uploader :data, RedactorRailsPictureUploader, 
  mount_on: :data_file_name,
  overwrite: true

Then overwrite could be passed along to mongoid's field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions