I have a model Post
and each time a post is created I want a new instance of Moderation
to be created at the same time.
So in post.rb I use the
Looks like you've added a unique index to your database:
t.index ["reportable_type", "reportable_id"], name: "moderations_reportable", unique: true
With a unique index you will only be able to have one record with the same reportable_type
and reportable_id
. It's likely that you're trying to create a moderation for a reportable that already has a moderation.