I have a some warnings about the referencing of foreign key,
i did try several way to solve this problem but i am still stuck with
foreign key.
is the syntax of setting foreign key is wrong?

can anyone help to fix the problem


~user table
id
name
address
guest


~ prescription table
id
person (integer)
picture
date_written

~user model
has_many :prescriptions

~ prescription model
  belongs_to :person, :foreign_key => "person" ,:class_name => 'User'


~userTest
  context "belong to and have many association " do
    should have_many :prescriptions
  end

~prescriptionTest
  context "belongs to relationship" do
    should belong_to :person
  end


  1) Failure:
test: belong to and have many association should have many
prescriptions. (UserTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
shoulda-2.11.3/lib/shoulda/context.rb:324]:
Expected User to have a has_many association called prescriptions
(Prescription does not have a user_id foreign key.).
Expected block to return true value.


thanks

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to