Skip to content

Commit 3d2014d

Browse files
author
Jeremy Anderson
committed
Fix missing param
1 parent e00dad8 commit 3d2014d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/paper_trail_association_tracking/version_concern.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def fetch_has_many_through(assoc, property)
6363

6464
versions = find_associated_versions(assoc.through_reflection)
6565

66-
return { "#{assoc.name}": updated_changes(versions) } if updated_changes(versions).any?
66+
return { "#{assoc.name}": updated_changes(assoc, versions, property) } if updated_changes(assoc, versions, property).any?
6767

68-
{ "#{assoc.name}": [removed_changes(versions), added_changes(versions)] }
68+
{ "#{assoc.name}": [removed_changes(assoc, versions, property), added_changes(assoc, versions, property)] }
6969
end
7070

7171
def find_associated_versions(assoc)
@@ -75,7 +75,7 @@ def find_associated_versions(assoc)
7575
.order('versions.created_at desc')
7676
end
7777

78-
def updated_changes(versions)
78+
def updated_changes(assoc, versions, property)
7979
versions.select { |version| version.event == "update" }
8080
.map(&:changeset)
8181
.pluck(assoc.foreign_key)
@@ -87,14 +87,14 @@ def updated_changes(versions)
8787
end
8888
end
8989

90-
def added_changes(versions)
90+
def added_changes(assoc, versions, property)
9191
versions.select { |version| version.event == "create" }
9292
.map(&:changeset)
9393
.pluck(assoc.foreign_key)
9494
.map { |change| assoc.klass.where(id: change.second).pick(property) }
9595
end
9696

97-
def removed_changes(versions)
97+
def removed_changes(assoc, versions, property)
9898
versions.select { |version| version.event == "destroy" }
9999
.map(&:changeset)
100100
.pluck(assoc.foreign_key)

0 commit comments

Comments
 (0)