Hi everyone- Just learning Rails, and I''m wondering if someone can help me out. I have a story controller: class StoriesController < ApplicationController def index @stories = Story.find(:all) end end and an index file to render the index action: <%= @stories.size %> stories so far. # THIS WORKS, I SEE THAT I HAVE 2 STORIES <h1>Stories</h1> <ul> <% render :partial => ''story'', :collection => @stories %> </ul> and a partial, _story.html.erb: <li> <%= story.headline %> </li> no matter what I try, I do not see the partial render. If do see that the variable is good, because I see the number "2" (I have 2 stories in the dummy database). Also, If I put static html in the partial, still, it doesn''t render. However, if I put some bogus embedded ruby in the partial, it causes an error, so I know it''s reading the partial. Any suggestions? Thanks, Dino --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<% render :partial => ''story'', :collection => @stories %> should be <%= render :partial => ''story'', :collection => @stories %> -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 25 Feb 2008, at 17:46, dino d. wrote:> <% render :partial => ''story'', :collection => @stories %>> no matter what I try, I do not see the partial render. If do see that > the variable is good, because I see the number "2" (I have 2 stories > in the dummy database). Also, If I put static html in the partial, > still, it doesn''t render. However, if I put some bogus embedded ruby > in the partial, it causes an error, so I know it''s reading the > partial.You need <%= render :partial ... not <% render :partial In general things that are blatantly just going to produce a chunk of html go in <%= blocks Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks for the fast reply, i knew i was having some newbie problem! dino On Feb 25, 12:56 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 25 Feb 2008, at 17:46, dino d. wrote: > > > <% render :partial=> ''story'', :collection => @stories %> > > no matter what I try, I do not see thepartialrender. If do see that > > the variable is good, because I see the number "2" (I have 2 stories > > in the dummy database). Also, If I put static html in thepartial, > > still, it doesn''t render. However, if I put some bogus embedded ruby > > in thepartial, it causes an error, so I know it''s reading the > >partial. > > You need <%= render :partial... not <% render :partial > In general things that are blatantly just going to produce a chunk of > html go in <%= blocks > > Fred--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---