Monday, July 11, 2011

[Rails] has_many and belongs_to association

Hi ,

I want to test the one below but I got the problem

belongs_to :name, :class_name => "Phrase", :foreign_key => "name"

in my test
context "test"do
should have_many :phrases
end

in language.rb
belongs_to :name, :class_name => "Phrase", :foreign_key => "name"

error is


1) Failure:
test: check has_many and belongs_to association should have many
languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
shoulda-2.11.3/lib/shoulda/context.rb:324]:
Expected Phrase to have a has_many association called languages
(Language does not have a phrase_id foreign key.).
Expected block to return true value.


I dont really understand what it's warning now..


Yennie

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate