Papertrail and Carrierwave

前端 未结 3 2139
情歌与酒
情歌与酒 2021-02-15 01:33

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:14

    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.

提交回复
热议问题