On Tue, Jul 12, 2011 at 3:01 PM, Tom <[email protected]> wrote: > model language.rb > class Language < ActiveRecord::Base > belongs_to :phraes, :class_name => "Phrase", :foreign_key => "name" > end >
I did fix the spelling already belongs_to :phrase, :class_name => "Phrase", :foreign_key => "name" > > Id phrase misspelled? > T > > On Jul 12, 1:13 pm, Yennie <[email protected]> wrote: > > On Jul 11, 2:59 pm, Frederick Cheung <[email protected]> > > wrote: > > > > > > > > > > > > > > > > > On 11 Jul 2011, at 17:59, Yennie <[email protected]> wrote: > > > > > > On Jul 11, 12:13 pm, Colin Law <[email protected]> wrote: > > > >> On 11 July 2011 17:05, Yennie <[email protected]> wrote: > > > > > >>> 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: checkhas_manyandbelongs_to associationshould 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 ahas_manyassociationcalled 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.. > > > > > >> It might help us if you showed us the failing test. Also I think it > > > >> would be better to use name_id as the foreign key for language > > > >>belongs_to:name. > > > > > >> Colin > > > > > > model language.rb > > > > class Language < ActiveRecord::Base > > > >belongs_to:phraes, :class_name => "Phrase", :foreign_key => "name" > > > > end > > > > > > model phrase.rb > > > >has_many:phrases, :class_name => "Phrase", :foreign_key => > > > > "category_id" > > > > belongs_to:category, :class_name => "Phrase" > > > > > > has_many:languages > > > > end > > > > > > test file phrase_test.rb > > > > context "checkhas_manyandbelongs_to association" do > > > > should belong_to :category > > > > should have_many :phrases > > > > should have_many :languages > > > > end > > > > > > error > > > > > > Started > > > > ..........F....................................... > > > > Finished in 1.313199 seconds. > > > > > > 1) Failure: > > > > test: checkhas_manyandbelongs_to associationshould 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 ahas_manyassociationcalled languages > > > > (Language does not have a phrase_id foreign key.). > > > > Expected block to return true value > > > > > The test claims to be failing because the languages table does not have > a phrase_id column. Does it? > > > > > Fred > > > > I have language table > > id > > name (integer) > > language_name (varchar) > > > > phrase table > > id > > name (varchar) > > category_id (integer) > > > > I have name as references to phrase.. > > can anyone help me plzz?? > > > > > > > > > > > > > > > > > > > > > > plz help .. 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 athttp:// > groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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. > > -- 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.

