On 14 July 2011 14:56, joanne ta <[email protected]> wrote:
> 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

Why is the foreign key "name"? Is the "name" field in language a text
field, or an integer? It needs to be an integer to store the id of the
Phrase, and would make more sense as "name_id".

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