You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Foo
has_many :foo_bars
audited
has_associated_audits
end
class Bar
has_many :foo_bars
audited
has_associated_audits
end
class FooBar
self.primary_key = [:foo_id, :bar_id] # i.e., there is no "id" column
belongs_to :foo
belongs_to :bar
audited associated_with: :foo
audited associated_with: :bar
end
Currently it would give an error similar to this:
ActiveRecord::CompositePrimaryKeyMismatchError:
Association FoobBar#audits primary key ["foo_id", "bar_id"] doesn't match with foreign key auditable_id. Please specify query_constraints, or primary_key and foreign_key values.
The text was updated successfully, but these errors were encountered:
I think that'd be a great addition, but I don't personally have any projects with composite primary keys, so my motivation to add this is low. I'd gladly review a PR.
Can
audited
support the following scenario using Rails 7.1's composite primary keys?Currently it would give an error similar to this:
The text was updated successfully, but these errors were encountered: