Hi, I am trying paginate (will_paginate) users posts. It is counting and showing the page links correctly, but still showing all the posts on one page. @entries = @user.entries.paginate :per_page => 5, :page => params[:page], :order => ''created_at DESC'' If I change it to @entries = Entry.paginate :per_page => 5 ........ It is fine, but I would like to show only given users posts. Thx, pete -- 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 -~----------~----~----~----~------~----~------~--~---
On Nov 27, 11:30 am, Petan Cert <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I am trying paginate (will_paginate) users posts. It is counting and > showing the page links correctly, but still showing all the posts on one > page. > > @entries = @user.entries.paginate :per_page => 5, :page => > params[:page], :order => ''created_at DESC'' > > If I change it to @entries = Entry.paginate :per_page => 5 ........ > It is fine, but I would like to show only given users posts. >Is your entries association funny in any way ? Fred> Thx, pete > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> Is your entries association funny in any way ? > FredHi Fred, thanks. I have users and entries controller. In my show controller (mydomain.com/profile/:username), I am using <% for entry in @user.entries %> to show user posts. I dont know, if it is funny in any way or not. :). USERSCONTROLLER: def show @entry = Entry.new username = params[:username] @user = User.find_by_username(username) @entries = @user.entries.paginate :per_page => 3, :page => params[:page], :order => ''created_at DESC'' . . . end ENTRIESCONTROLLER: def show @entry = Entry.find_by_id_and_user_id(params[:id], params[:user_id], :include => [:user, [:comments => :user]]) end THX -- 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 -~----------~----~----~----~------~----~------~--~---
On Nov 28, 8:23 am, Petan Cert <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > Is your entries association funny in any way ? > > Fred > > Hi Fred, > thanks. I have users and entries controller. In my show controller > (mydomain.com/profile/:username), I am using <% for entry in > @user.entries %> to show user posts. I dont know, if it is funny in any > way or not. :).That''s not what I meant. What I meant was does it have any interesting options on it that might confuse will paginate ? Fred> > USERSCONTROLLER: > def show > @entry = Entry.new > username = params[:username] > @user = User.find_by_username(username) > @entries = @user.entries.paginate :per_page => 3, :page => > params[:page], :order => ''created_at DESC'' > . > . > . > end > > ENTRIESCONTROLLER: > def show > @entry = Entry.find_by_id_and_user_id(params[:id], params[:user_id], > :include => [:user, [:comments => :user]]) > end > > THX > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> That''s not what I meant. What I meant was does it have any interesting > options on it that might confuse will paginate ? > > FredNo, its just a plain text and thats it. It is a simple sideblog (user_id,body,created_at).Could it be problem, that I am using data from entries controller in User controller? Cheers, Pete -- 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 -~----------~----~----~----~------~----~------~--~---
On Nov 28, 10:15 am, Petan Cert <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > That''s not what I meant. What I meant was does it have any interesting > > options on it that might confuse will paginate ? > > > Fred > > No, its just a plain text and thats it. It is a simple sideblog > (user_id,body,created_at).That''s not what I meant. I was thinking of things like custom :finder_sql and so on>Could it be problem, that I am using data from > entries controller in User controller?No. You mentionned> I am using <% for entry in > @user.entries %> to show user posts. I dont know, if it is funny in any > way or not. :).If you actually have that line in your view you''ll be ignoring the pagination stuff completely, since @entries is the thing with the limited collection Fred> -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> If you actually have that line in your view you''ll be ignoring the > pagination stuff completely, since @entries is the thing with the > limited collection > > FredHi Fred, all right, thanks. I''ve just tried to render the posts as collections of partials. <%= render :partial => ''user_posts'', :collection => @user.entries %> But it is still the same. Is there another way to show only the users posts and then be able to paginate them? THX -- 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 -~----------~----~----~----~------~----~------~--~---
On Nov 28, 1:04 pm, Petan Cert <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > If you actually have that line in your view you''ll be ignoring the > > pagination stuff completely, since @entries is the thing with the > > limited collection > > > Fred > > Hi Fred, > > all right, thanks. I''ve just tried to render the posts as collections of > partials. <%= render :partial => ''user_posts'', :collection => > @user.entries %>no. you need :collection => @entries (assuming that in your controller you''ve done @entries = @user.entries.paginate ...> > But it is still the same. Is there another way to show only the users > posts and then be able to paginate them? THX > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---