Hello. I am trying to use the will_paginate plugin and I like it very much. I have read an entry in this forum <http://www.ruby-forum.com/topic/109036>, about making will_paginate an acts_as taggable playing together and that make me think it will be easy to paginate on a query moved to the model, like it was suggested from Jamis Bucks in a known article "Skinny controller, Fat Mode". I have defined a query method in the model class Thing def self.find_special_list find(:all, :conditions => ...) end alias find_all_special_list find_especial_list end I pretend paginate with this @things = Thing.paginate_special_list and I have a strange error saying that find_special_list is not defined or something like that. Anybody has tried this?. Is possible to paginate a collection queried with a class method? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
just to be sure: alias find_all_special_list find_especial_list should not be alias find_all_special_list find_special_list and def self.find_special_list is really a class method ? marcel On 26 Mai, 17:26, Juanma Cervera <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello. > I am trying to use the will_paginate plugin and I like it very much. > > I have read an entry in this forum > <http://www.ruby-forum.com/topic/109036>, about making will_paginate an > acts_as taggable playing together and > that make me think it will be easy to paginate on a query moved to the > model, > like it was suggested from Jamis Bucks in a known article "Skinny > controller, Fat Mode". > > I have defined a query method in the model > > class Thing > def self.find_special_list > find(:all, :conditions => ...) > end > alias find_all_special_list find_especial_list > end > > I pretend paginate with this > @things = Thing.paginate_special_list and I have a strange error saying > that find_special_list is not defined or something like that. > > Anybody has tried this?. Is possible to paginate a collection queried > with a class method? > > Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You ''re right it should be find_all_special_list find_special_list and I pretend that find_special_list be a class method (a custom finder method) Maybe the alias methods can not be used with class methods, can it? lanzm wrote:> just to be sure: > alias find_all_special_list find_especial_list > > should not be > alias find_all_special_list find_special_list > > and > def self.find_special_list > > is really a class method ? > > marcel > > On 26 Mai, 17:26, Juanma Cervera <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- 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 5/28/07, Juanma Cervera <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> You ''re right > it should be find_all_special_list find_special_list > and I pretend that find_special_list be a class method (a custom finder > method) > Maybe the alias methods can not be used with class methods, can it?class Whatever < ActiveRecord::Base class << self alias_method :target, :source end end or http://pastie.caboo.se/66108 -- Chris Wanstrath http://errfree.com // http://errtheblog.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 -~----------~----~----~----~------~----~------~--~---
Thank you very much Chris -- 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 -~----------~----~----~----~------~----~------~--~---
Well, I think I go to nowhere with this idea. I tried to move the query I am paginating from the controller to the model. I want to have my controllers as skinny as possible. But, obviously I donĀ“t want to move the paginate method to the model, nor fight with pages, offsets and limits in the query, only I wan to use a finder defined there. Anythody thinks this is something possible with pagination? How? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---