I have a users table and a pools table. The users table has a column called facebook_id which I want to set to be the primary_key. The pools table has a column called creator_facebook_id.
I want to perform a simple join where users.facebook_id = pools.creator_facebook_id
I'm trying to do this through active record by placing the following code in my models
class Pool < ActiveRecord::Base
  belongs_to :user, :foreign_key => "facebook_id"
end
class User < ActiveRecord::Base
  has_many :pools, :foreign_key => "creator_facebook_id"
end
Then I when I have a list of pools I'd like to be able to do something like this
pool.user.name
And return the name (stored in the users table) associated with the pool. This must be quite simple where am I going wrong?