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:
- 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.
- 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.
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::mount_on => :data_file_name, which is the name of the field that redactor-rails already defined, then a warning is produced.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:
Then
overwritecould be passed along to mongoid'sfield.