Forum: Ruby on Rails blog model?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ana B. (Guest)
on 2006-04-24 02:18
I just finished my auth zone and have some controllers to add content in
the admin zone, now i want to build a blog, i have the 2 tables, posts
and comments but i still dont get how to relate them, someone knows how
to make a blog structure/model in rails?

Any help will be very apreciated :)
Adam B. (Guest)
on 2006-04-24 02:46
Ana B. wrote:
> I just finished my auth zone and have some controllers to add content in
> the admin zone, now i want to build a blog, i have the 2 tables, posts
> and comments but i still dont get how to relate them, someone knows how
> to make a blog structure/model in rails?
>
> Any help will be very apreciated :)

Post has_many comments, Comment belongs_to post.

Then where you want to display comments:

<% for comment in some_post.comments %>
   <%= comment display code %>
<% end %>
Magnus (Guest)
on 2006-04-24 06:12
(Received via mailing list)
Adam B. <admanb@...> writes:

>
> Ana B. wrote:
> > I just finished my auth zone and have some controllers to add content in
> > the admin zone, now i want to build a blog, i have the 2 tables, posts
> > and comments but i still dont get how to relate them, someone knows how
> > to make a blog structure/model in rails?




why not check out the blog from the screencasts at www.rubyonrails.org?
follow what they're doing and you should have it running in 15mins
This topic is locked and can not be replied to.