add paper trail
This commit is contained in:
@@ -2,5 +2,12 @@
|
||||
module Admin
|
||||
class ApplicationController < Administrate::ApplicationController
|
||||
before_action :authenticate_admin_user!
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
# used by #set_paper_trail_whodunnit
|
||||
def current_user
|
||||
# add admin prefix to differentiate from a customer
|
||||
"admin/#{current_admin_user.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
class ApplicationController < ActionController::Base
|
||||
before_action :set_paper_trail_whodunnit
|
||||
before_action :configure_devise_permitted_parameters, if: :devise_controller?
|
||||
|
||||
protected
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class Balance < ApplicationRecord
|
||||
include Trackable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :currency
|
||||
|
||||
|
||||
8
app/models/concerns/trackable.rb
Normal file
8
app/models/concerns/trackable.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
module Trackable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_paper_trail
|
||||
end
|
||||
end
|
||||
@@ -20,6 +20,8 @@
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class FiatBalance < ApplicationRecord
|
||||
include Trackable
|
||||
|
||||
belongs_to :user
|
||||
|
||||
monetize :amount_cents
|
||||
|
||||
Reference in New Issue
Block a user