On 12 Feb 2009, at 00:21, Pete wrote:

> class Employee < ActiveRecord::Base
>  has_one :job

has_one :job, :foreign_key => "shssn", :dependent => :destroy

>  set_primary_key "emssan"
>  def self.table_name() "peis301" end
>  def name
>    "#{emfnam} #{emlnam}"
>  end
> end
>
>
> The question is: Why is Rails looking for a key called EMPLOYEE_ID
> when I set the primary key value to "emssan"?  How do I fix this?

You probably need to define the foreign key in the has_one  
relationship too.


Best regards

Peter De Berdt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to