Hi:
I''ve got an array i''d like to paginate. It''s a
collection of the same
model, but I can''t seem to paginate accordingly. Here''s my
code:
<%pics = PictureCategory.find_goal_pics(uid)
pics = pics.paginate
pics.each do |p| %>
<div style="float: left; text-align: center; padding: 5px;
margin-right: 5px; width: 70px;">
<%= image_tag(p.public_filename(:small), :alt => "goal
picture", :class => "goalpic")%><br>
<span class="black_lg"><%=
p.picture_category.name %></span>
</div>
<% end %>
<% end %>
<span class="black">
<%= will_paginate pics %></span>
But there''s no pagination on the page, similarly I tried:
pics = pics.paginate(:all, :per_page => 8)
which didn''t work either. I''m sure I don''t
understand enough about
will_paginate. You help is as always greatly appreciated.
Mike
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
This is the we got the output:
@docket_types = DocketType.paginate :page => params[:page], :per_page
=> 5, :conditions => ["court_id in
(#{@current_user.court_ids.join('',
'')})"]
<%= will_paginate @docket_types %>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
So I''m still having problmes, having just discovered that even though
pagination correctly splits up my page, when you click on a page link,
it doesn''t actually work! :(
My problem is that the array I compile is actually a combination of a
few different type of models. What do I do in this case (notice the
hack at the end):
def index
@goals = Search.search_goals(params[:search])
@people = Search.search_people(params[:search])
@all = []
#mark goals and people and teams for easier presentation processing
(has to do with the way I display in the view)
@goals.each do |g|
@all << ["g",g]
end
@people.each do |p|
@all << ["p",p]
end
#here''s the pagination hack
all_temp = @all
@all = all_temp.paginate
end
note that:
@all = all_temp.paginate(:all, :page => params[:page], :per_page => 10)
gives the error:
undefined method `to_i'' for {:per_page=>10}:Hash
Any help you can give would be greatly appreciated!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---