Topic: Having trouble figuring out will_paginate and attachment_fu model
I'm trying to use the will_paginate plugin to paginate some athlete names and display their thumbnail image from the associated attachment_fu table together.
While this sounds and probably is incredibly simple, I'm having syntax issues. I've tried following and using syntax from other threads and haven't had much luck.
:athlete has_many :athlete_pictures and athlete_pictures belongs_to :athlete
@athletes = Athlete.find(:all)
@athlete_pictures = @athletes.athlete_pictures.thumbnail("thumb").paginate_by_id @athlete, :per_page => 10, :page => params[:page],
:order => @athlete.last_name
<% @athletes.each do |a| %>
<%= image_tag a.athlete_picture.public_filename -%>
<%= h a.name %>
<%= link_to 'View Profile', :action => 'view_profile', :id => a %>
<% end %>
<%= will_paginate @athletes %>
And I get the error:
undefined method `athlete_pictures' for #<Array:0xb6b35cfc>
I have a feeling I need to put something in the model to handle this, but am not sure if I am on the right track at all after trying so many different things
Thanks in advance for looking!
Last edited by skerf (2007-10-07 01:33:12)