class User < ActiveRecord::Base belongs_to :creator, :class_name => 'Admin', :foreign_key => :creator_id end class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :name, :string t.column :creator_id, :string t.timestamps end end def self.down drop_table :users end end I override the naming associations by using the :class_name option in the belongs_to method. I am expecting that it is assocaited by the :creato_id in this case. However the error message shows that it is still looking for users.admin_id instead of users.creator_id though I specify the :foreign_key. How could that be?
on 2009-04-30 02:03