纸迹控制器作为元数据不起作用。 (Ruby 2.3.3、Rails 4.2 和 paper_trail 5.2.3)

Paper trail controller as meta data does not work. (Ruby 2.3.3, Rails 4.2 and paper_trail 5.2.3)

按照元数据从控制器捕获信息的步骤不起作用。 (Ruby 2.3.3,Rails 4.2 和 paper_trail 5.2.3)

型号

has_paper_trail only: [:status]

迁移

class AddHotelToVersions < ActiveRecord::Migration
    def change
        add_reference :versions, :hotel, index: true, foreign_key: true, null: false
        add_column :versions, :ip, :string, null: false
        add_column :versions, :user_agent, :string, null: false
    end
end

控制器

def info_for_paper_trail
    { hotel_id: current_user.hotel.id, ip: request.remote_ip, user_agent: request.user_agent }
end

我把paper trails升级到6.0.2解决了