On Thu, Jul 14, 2011 at 10:01 AM, Michael Pavling <[email protected]> wrote:
> 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 > is integer > > directions > > language_name > > ~phrase model > > class Phrase < ActiveRecord::Base > > has_many :languages > > end > > ~ phrase table > > id > > name > this is a string > > 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". > > name in language is integer (is foreign key of phrase) name in phrase is string please help > -- > 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.

