Use of guid values and foreign key constraints

It is pretty easy to make primary keys a guid value by:

class CreateAccounts < ActiveRecord::Migration
def self.up
create_table(:accounts, :primary_key => :guid) do |t|

But I am unsure how to create the foreign key constraints to allow them
to accept the guid values. Setting the column type fails (t.guid
:account_id), as it seems that guid an undefined method.

Setting the relational column to a string also causes a failure when
creating the foreign key constraints.

Does anyone have any experience with this?

I see there is a plugin here, but I don’t know if this will fix the
issue with the foreign keys.

Thanks for the help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs