Add action_logs association for account (#36022)
This commit is contained in:
parent
c1626486bc
commit
f861a5cee0
@ -4,10 +4,8 @@ module AccountableConcern
|
|||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def log_action(action, target)
|
def log_action(action, target)
|
||||||
Admin::ActionLog.create(
|
current_account
|
||||||
account: current_account,
|
.action_logs
|
||||||
action: action,
|
.create(action:, target:)
|
||||||
target: target
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,6 +12,7 @@ module Account::Associations
|
|||||||
has_many :account_notes
|
has_many :account_notes
|
||||||
has_many :account_pins
|
has_many :account_pins
|
||||||
has_many :account_warnings
|
has_many :account_warnings
|
||||||
|
has_many :action_logs, class_name: 'Admin::ActionLog'
|
||||||
has_many :aliases, class_name: 'AccountAlias'
|
has_many :aliases, class_name: 'AccountAlias'
|
||||||
has_many :bookmarks
|
has_many :bookmarks
|
||||||
has_many :collections
|
has_many :collections
|
||||||
|
|||||||
@ -8,6 +8,7 @@ RSpec.describe Account do
|
|||||||
|
|
||||||
describe 'Associations' do
|
describe 'Associations' do
|
||||||
it { is_expected.to have_many(:account_notes).inverse_of(:account) }
|
it { is_expected.to have_many(:account_notes).inverse_of(:account) }
|
||||||
|
it { is_expected.to have_many(:action_logs).class_name('Admin::ActionLog') }
|
||||||
it { is_expected.to have_many(:targeted_account_notes).inverse_of(:target_account) }
|
it { is_expected.to have_many(:targeted_account_notes).inverse_of(:target_account) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user