Petan Cert wrote: > <%= render :partial => 'recent_posts', :collection => @posts %> > @posts = Post.find(:all, ..., :limit => 5)
Using the new Rails method is prettier. If Rails sees @recent_posts it will automatically assume the name for the partial and pass through recent_posts as a local posts variable. <%= render :partial => @recent_posts %> > #_recent_posts.rhtml > <%= image_tag recent_posts.photo.url(:thumb) %> > > and it will end up with this error: > "undefined method `symbolize_keys!' for \"/posts/24?user_id=1\":String" The :collection passed through is @posts. But you are referencing recent_posts instead which is different. If you go with rails iterating through the collection then the singularization of the plural name will create "recent_post" from "@recent_posts" and you can reference the name that way. <%= image_tag recent_post.photo.url(:thumb) %> If passing in @recent_posts doesn't make sense then you would need to reference through @posts with something like post.photo.url(:thumb) where post was created by rails for iterating over the @posts collection. http://api.rubyonrails.org/classes/ActionController/Base.html Bob --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

