diff --git a/app/controllers/admin/budget_investment_audits_controller.rb b/app/controllers/admin/budget_investment_audits_controller.rb index ec38952a6..208367220 100644 --- a/app/controllers/admin/budget_investment_audits_controller.rb +++ b/app/controllers/admin/budget_investment_audits_controller.rb @@ -1,7 +1,7 @@ class Admin::BudgetInvestmentAuditsController < Admin::BaseController def show investment = Budget::Investment.find(params[:budget_investment_id]) - @audit = investment.audits.find(params[:id]) + @audit = investment.own_and_associated_audits.find(params[:id]) render "admin/audits/show" end diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index bb94476af..7f0bdb0f5 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -33,6 +33,11 @@ class Budget include Globalizable audited on: [:update, :destroy] + has_associated_audits + translation_class.class_eval do + audited associated_with: :globalized_model, + only: Budget::Investment.translated_attribute_names + end belongs_to :author, -> { with_hidden }, class_name: "User", inverse_of: :budget_investments belongs_to :heading diff --git a/app/views/admin/audits/_audits.html.erb b/app/views/admin/audits/_audits.html.erb index 672abd93e..dc7bf87b1 100644 --- a/app/views/admin/audits/_audits.html.erb +++ b/app/views/admin/audits/_audits.html.erb @@ -16,7 +16,7 @@
- <% resource.audits.order(:created_at).each do |audit| %> + <% resource.own_and_associated_audits.order(:created_at).each do |audit| %> <% audit.audited_changes.each do |field, (old_value, new_value)| %>