hi, i am trying to pass the paginate_collection function this. @pages, @viewObj = paginate_collection Mcategory.find(params[:id], :include => {:scategories => :howtos}), :page => @params[:page] however, the problem seems that this format cant be read into the collection.size method. NoMethodError (undefined method `size'' for #<Mcategory:0x22b0c84>): /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1792:in `method_missing'' but when i try with a simple collection call of find(:all), it works fine. so i am guessing it doesnt like my include statement. -- 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 -~----------~----~----~----~------~----~------~--~---
i am using this... def paginate_collection(collection, options = {}) logger.debug "----~CALLING PAGIONATE!!!!== " default_options = {:per_page => 5, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] #pages = Paginator.new self, 50, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collection.size].min #last = [first + options[:per_page], 50].min slice = collection[first...last] return [pages, slice] end -- 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 -~----------~----~----~----~------~----~------~--~---