Skip to content

Can't handle UUIDs #57

@pachacamac

Description

@pachacamac

I tried to use UUIDs for my taggable object resulting in

ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  invalid input syntax for integer: "b8cc337e-8535-4115-b782-e261c4cfa32a"
: SELECT "gutentag_tags".* FROM "gutentag_tags" INNER JOIN "gutentag_taggings" ON "gutentag_tags"."id" = "gutentag_taggings"."tag_id" WHERE "gutentag_taggings"."taggable_id" = $1 AND "gutentag_taggings"."taggable_type" = $2

trying to debug it now. found the problem.

Had to modify the generated migration from

create_table :gutentag_taggings do |t|
      t.integer :tag_id,        null: false
      t.integer :taggable_id,   null: false
      t.string  :taggable_type, null: false
      t.timestamps null: false
    end

to

create_table :gutentag_taggings do |t|
      t.integer :tag_id,        null: false
      t.uuid :taggable_id,   null: false
      t.string  :taggable_type, null: false
      t.timestamps null: false
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions