I'm in the middle of a migration to Postgres from MySQL and i'v hit an issue that I just can't solve. I'm sure there is simple answer, but i'm stuck.
The Problem
I have a step model that belongs to a template model, but specifies a foreign key called template_uuid to match on the template tables uuid column.
This all worked fine on MySQL but now does not work on Postgres. Calling step.template would return the relevant template but now it returns nil
Both the uuid column on the template table and the template_uuid column on the step are UUID data types.
Example:
class Step < ActiveRecord::Base
belongs_to :template, :foreign_key => :template_uuid
So, I get nil when trying to call the association
step = Step.last
step.template => nil
But, I can query for the template using the template_uuid column, and it works just fine
Template.where(:uuid => step.template_uuid).first
So .. What am I missing here. The records and UUID's clearly line up so why does this relationship break now that i'm using Postgres. There is no physical foreign key on the database, but that's never mattered before.
Does anyone have any ideas?