If you have your model associations setup properly you should be able
to access them using post.comments

For example:

class Post < ActiveRecord::Base
  has_many :comments
end

class Comment < ActiveRecord::Base
  belongs_to :post
end

In _post.rhtml you can do

<%= render :partial => "comment/comment", :collection => post.comments
%>

That assumes you have a partial called _comment.rhtml in the "comment"
directory under views.

On Jul 21, 6:53 pm, John Mossel <rails-mailing-l...@andreas-s.net>
wrote:
> hi,
> Does anyone know how I can render a partial that has an assosciation
> with something else (e.g. render a comments partial in posts-- where the
> comments belong to posts).
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to