Partial repeating the output from a collection

I have an array I’m trying to output with partials. The query find
entries in the database correctly but the results are getting
outputted repeatedly.

For example, if there are 3 results from the query it would display
the 3 partials 3 times, if it was 4 it would repeat 4 times etc. Heres
what it would look like if "@albums = Album.find(@albumids) " found 3
ID’s

First Partial (id=1)
Second Partial (id=2)
Third Partial (id=3)
First Partial (id=1)
Second Partial (id=2)
Third Partial (id=3)
First Partial (id=1)
Second Partial (id=2)
Third Partial (id=3)

Heres the array and query

 @activity = Activity.count( :group => 'album_id',
                             :conditions => ['created_at >= ?',

@time],
:order => “count_all DESC”,
:limit => 5 )
@albumids = @activity.map { |a| a[0] }
@albums = Album.find(@albumids)

And partial line

<%= render :partial => “album”, :collection => @albums %>

Any thoughts?

  @albums = Album.find(@albumids)

And partial line

<%= render :partial => “album”, :collection => @albums %>

Any thoughts?

I suspect you have a problem with the query that sets up @albumids; your
render line will generate a line for each object in the @albums
collection, so if you are seeing the same album repeated, it is likely
because it is repeated in the @albums collection.

You could check this by running ruby script/console, and testing your
find logic by entering the three lines:
@activity = Activity.count( :group => ‘album_id’,
:conditions => [‘created_at >= ?’,
@time],
:order => “count_all DESC”,
:limit => 5 )
@albumids = @activity.map { |a| a[0] }
@albums = Album.find(@albumids)

Hope this helps…