Papertrail and Carrierwave

前端 未结 3 1474
醉话见心
醉话见心 2021-02-15 01:41

I have a model that use both: Carrierwave for store photos, and PaperTrail for versioning.

I also configured Carrierwave for store diferent files when upda

3条回答
  •  一整个雨季
    2021-02-15 02:03

    Adding @beardedd's comment as an answer because I think this is a better way to handle the problem.

    Name your database columns something like picture_filename and then in your model mount the uploader using:

    class User < ActiveRecord::Base has_paper_trail mount_uploader :picture, PictureUploader, mount_on: :picture_filename end

    You still use the user.picture.url attribute to access your model but PaperTrail will store revisions under picture_filename.

提交回复
热议问题