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?
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 %>
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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.