On Wed, Jul 13, 2011 at 4:25 PM, Colin Law <[email protected]> wrote:

> On 13 July 2011 14:29, joanne ta <[email protected]> wrote:
> >
> >
> > 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"
>
> So since you have not said I assume it is all now working?
>
> If not did you try including the foreign key with has_many :languages,
> as I suggested?
>
> If it is still not working please re-post the code and error exactly
> as it is now (copy/paste, do not re-type it).
>
> Colin
>

It does work at all. it just keeps giving me the same warning ..

~language model

class Language < ActiveRecord::Base
  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
  belongs_to :phrase
  has_many :users
end

~ language table
id
name
directions
language_name

~phrase model
class Phrase < ActiveRecord::Base
  has_many :languages
end

~ phrase table
id
name
category


  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.

please help and 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.
>
>

-- 
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