Blog model?


#1

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


#2

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

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


#3

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