trying to do my first rails app (surprise, it''s a blog!) anyhow. in list.rhtml, i have this: <% for post in @posts render(:partial => "post", :object=>post) end %> and in _post.rhtml, i have: <tr> <td><%= post.title%> <br /> <%= post.body%> <br /> problem is, no content shows up -- displays a blank page. for the record, if i put that same partial within the list.rhtml, i get the content displayed correctly. thanks in advance for the help
On 2/5/06, matthew collins <matthewcollins@cfl.rr.com> wrote:> trying to do my first rails app (surprise, it''s a blog!) > > anyhow. > > in list.rhtml, i have this: > > <% for post in @posts > > render(:partial => "post", :object=>post) > > > end %> > > and in _post.rhtml, i have: > > <tr> > <td><%= post.title%> > <br /> > <%= post.body%> > <br /> > > problem is, no content shows up -- displays a blank page. for the > record, if i put that same partial within the list.rhtml, i get the > content displayed correctly. >Try replacing these three lines: <% for post in @posts %> <%= render(:partial => "post", :object=>post) %> <% end %> ..with: <%= render :partial => ''post'', :collection => @posts %> The other way would be to do: <% for post in @posts %> <%= render :partial => ''post'', :locals => {:post => post} %> <% end %> ..but that''s three times as much code. :)
not to burn bandwidth with a simple ''thanks''; but, wow --- that''s simple. thanks! Wilson Bilkovich wrote:>On 2/5/06, matthew collins <matthewcollins@cfl.rr.com> wrote: > > >>trying to do my first rails app (surprise, it''s a blog!) >> >>anyhow. >> >>in list.rhtml, i have this: >> >><% for post in @posts >> >> render(:partial => "post", :object=>post) >> >> >>end %> >> >>and in _post.rhtml, i have: >> >><tr> >> <td><%= post.title%> >> <br /> >> <%= post.body%> >><br /> >> >>problem is, no content shows up -- displays a blank page. for the >>record, if i put that same partial within the list.rhtml, i get the >>content displayed correctly. >> >> >> > >Try replacing these three lines: ><% for post in @posts %> > <%= render(:partial => "post", :object=>post) %> ><% end %> > >..with: ><%= render :partial => ''post'', :collection => @posts %> > >The other way would be to do: ><% for post in @posts %> ><%= render :partial => ''post'', :locals => {:post => post} %> ><% end %> > >..but that''s three times as much code. :) >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >