In your partial, you use the variable post. But post doesn't exist. At least not as far as I can see. You've sent along a variable @posts and you will probably have to use that in some kind of for loop.
For example: <% for post in @posts do %> <% div_for post do %> <h2><%= link_to_unless_current h(post.title), post %></h2> <%= truncate(post.body, :length => 300) %> <br /><br /> <% end %> <% end %> Hope this helps! Jaap Haagmans w. http://www.relywebsolutions.nl On 9 aug, 00:12, Philip Gavrilos <rails-mailing-l...@andreas-s.net> wrote: > im getting: undefined local variable or method `post' for > #<ActionView::Base:0x2673624> > where in my code i have the mistake ? please help.. > > code at index.html.erb > <br/> > <h1>welcome to my weblog!</h1><br/> > <%= render :partial => "posts/preview", :collection => @posts %><br /> > <%= link_to 'New post', new_post_path %> > > code at _preview.html.erb > <% div_for post do %> > <h2><%= link_to_unless_current h(post.title), post %></h2> > <%= truncate(post.body, :length => 300) %> <br /><br /> > <% end %> > -- > 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 -~----------~----~----~----~------~----~------~--~---