NoMethodError

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

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

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