Skip to content

Unable to add a primary_key to the users_roles table... (with caveat) #177

@Altonymous

Description

@Altonymous

Caveat: I am using the ActiveUUID gem instead of using auto-incrementing keys. So this issue may be related to that if you are unable to reproduce.

Because of the way we do change data capture all tables in our database require a primary_key. Even though mapping tables only do insert/delete we still want to track if a user has ever had certain permissions.

In the method:

  def add(relation, role)
    relation.role_ids |= [role.id]
  end

It doesn't appear to generate the primary_key on creation of the record.

I also tried...

  def add(relation, role)
    relation.roles << role
  end

However, it results in the same issue for me.

If this is indeed related to ActiveUUID I apologize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions