# NoMethodError

**URL:** <https://www.ruby-forum.com/t/nomethoderror/122215>\
**Category:** Rails\
**Created:** [December 5, 2007, 5:32pm UTC](https://www.ruby-forum.com/t/nomethoderror/122215 "2007-12-05T17:32:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wmerydith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ccd318/32.png) [@wmerydith](https://www.ruby-forum.com/u/wmerydith)\
**Post date:** [December 5, 2007, 5:32pm UTC](https://www.ruby-forum.com/t/nomethoderror/122215/1 "2007-12-05T17:32:25Z")

</div>

Hi, i am trying to build a news feed. The way information is put into  
it, is from when the other db i have is updated, that is all working. I  
am just having trouble with showing the feed in the view.  
I keep getting this error:

NoMethodError in Admin/post#recent

Showing app/views/admin/post/\_feed.rhtml where line #1 raised:

undefined method `fed’ for #Array:0x35207d0  
Extracted source (around line #1):

1: \<%= @newsfeeds.fed %\>

this is my view:

News Feed   
\<%= render :partial =\> "feed", :collection =\> @newsfeeds %\>

And this is my controller:

def recent  
@newsfeeds = Newsfeeds.find(:all)  
end

It seems to work it i have it out of a partial and if the controller is  
newsfeed.find(:first), but i want to show everything in the db??

Any help would be appreciated,

thanks Will

---

<div class="post-metadata">

**Author:** ![wmerydith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ccd318/32.png) [@wmerydith](https://www.ruby-forum.com/u/wmerydith)\
**Post date:** [December 5, 2007, 5:49pm UTC](https://www.ruby-forum.com/t/nomethoderror/122215/2 "2007-12-05T17:49:24Z")

</div>

On 5 Dec 2007, at 16:32, Will Monk wrote:

> Showing app/views/admin/post/\_feed.rhtml where line #1 raised:
> 
> undefined method `fed’ for #Array:0x35207d0  
> Extracted source (around line #1):
> 
> 1: \<%= @newsfeeds.fed %\>

@newsfeeds is a array (as the error message tells you). You’re  
rendering a collection, with a partial called ‘feed’ which means that  
the element of the array being considered is materialised as a local  
variable called feed. assuming fed is the method you want to call you  
need feed.fed, not @newsfeeds.fed

Fred

---

<div class="post-metadata">

**Author:** ![wmerydith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ccd318/32.png) [@wmerydith](https://www.ruby-forum.com/u/wmerydith)\
**Post date:** [December 5, 2007, 5:55pm UTC](https://www.ruby-forum.com/t/nomethoderror/122215/3 "2007-12-05T17:55:25Z")

</div>

Frederick C. wrote:

> On 5 Dec 2007, at 16:32, Will Monk wrote:
> 
> > Showing app/views/admin/post/\_feed.rhtml where line #1 raised:
> > 
> > undefined method `fed’ for #Array:0x35207d0  
> > Extracted source (around line #1):
> > 
> > 1: \<%= @newsfeeds.fed %\>
> 
> @newsfeeds is a array (as the error message tells you). You’re  
> rendering a collection, with a partial called ‘feed’ which means that  
> the element of the array being considered is materialised as a local  
> variable called feed. assuming fed is the method you want to call you  
> need feed.fed, not @newsfeeds.fed
> 
> Fred

Thanks for that speedy reply! You were right, now it’s all working fine.  
This was the first time i had named the partial something different to  
what it was containing, so i couldnt work that one out… but thanks  
again!

Will
