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 :) -- Posted via http://www.ruby-forum.com/.
Ana Barrueta 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 %> -- Posted via http://www.ruby-forum.com/.
Adam Bloom <admanb@...> writes:> > Ana Barrueta 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