Nested Model/Routes in Rails 3
- by mbreedlove
I have a simple blogging functionality in my Rails 3 app. I am trying to add commenting to each post. The BlogComment model has a property, blog_post_id, to be able to find the corresponding comments for each post. I already setup my associations in the model, I also nested BlogComments under BlogPost in the routes file.
However, I can't figure out how to give each BlogPost access to its respective comments through the controller so that they can be shown later in the view.