Following this tutorial: http://edgeguides.rubyonrails.org/getting_started.html Under; 7.1 Generating a Model It mentions the following for creating a "Comment" model: $ rails generate model Comment commenter:string body:text post:references In post:references What is "references"? Is it a data type? And, what does it represent? Thanks. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I saw down few lines in the tutorial the following: The t.references line sets up a foreign key column for the association between the two models. Go ahead and run the migration: So, is "references" simply a "Foreign key"? Thanks. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 14 August 2010 13:26, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I saw down few lines in the tutorial the following: > > The t.references line sets up a foreign key column for the association > between the two models. Go ahead and run the migration:So did you go ahead and run it? What did it generate in the db for this field? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 14 August 2010 13:26, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I saw down few lines in the tutorial the following: >> >> The t.references line sets up a foreign key column for the association >> between the two models. Go ahead and run the migration: > > So did you go ahead and run it? What did it generate in the db for this > field? > > ColinI found that there is a "post_id" column in the "comments" table. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 14 August 2010 13:48, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote: >> On 14 August 2010 13:26, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> I saw down few lines in the tutorial the following: >>> >>> The t.references line sets up a foreign key column for the association >>> between the two models. Go ahead and run the migration: >> >> So did you go ahead and run it? What did it generate in the db for this >> field? >> >> Colin > > I found that there is a "post_id" column in the "comments" table.There you are then, presumably in the example Comment belongs_to Post, so this is generating the foreign key field for the post. Question answered. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
clanlaw wrote:> On 14 August 2010 13:48, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> Colin >> >> I found that there is a "post_id" column in the "comments" table. > > There you are then, presumably in the example Comment belongs_to Post, > so this is generating the foreign key field for the post. Question > answered. > > ColinWhat do you mean by run it? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 14 August 2010 15:59, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> clanlaw wrote: >> On 14 August 2010 13:48, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>>> Colin >>> >>> I found that there is a "post_id" column in the "comments" table. >> >> There you are then, presumably in the example Comment belongs_to Post, >> so this is generating the foreign key field for the post. Question >> answered. >> >> Colin > > What do you mean by run it?What do you mean, "what do you mean by run it?"? I don''t see any reference to running anything in my post. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
clanlaw wrote:> On 14 August 2010 15:59, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> Colin >> >> What do you mean by run it? > > What do you mean, "what do you mean by run it?"? I don''t see any > reference to running anything in my post. > > ColinThis is when you said: So did you go ahead and "run it"? What did it generate in the db for this field? But, anyway, I got the idea now. Thanks. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.