I think you have already set up the has_many relationship. That is all
it takes.
Now you can display comments below every post by using a selection
operation matching the post_id colums in both tables.

something like...

find all where post_id = post_post
hope you got it.

On Apr 3, 8:33 am, David Zhu <[email protected]> wrote:
> I made a posts scaffold, and a comments scaffold
>
> Now i want to link the two of them together by --
>
> Post--
>
> has_many :comments
>
> and comments-
>
> belongs_to :post
>
> After that, I have no idea what to do in the controller or form for my
> comments
>
> What do i need to change in the comments controller and form so every
> comment  that gets created is assigned to a post?
>
> Btw, i already have a post_id:integer column in my comments table
>
> I REALLY NEED HELP!! thanks a lot

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