14.2 confusion/This used to work


#1

ok this worked previously…

i am getting:

NoMethodError in Admin/todo#live_search

undefined method `paginate_collection’ for
#Admin::TodoController:0x815a818

what is the error here?

i have:

admin/todo_controller.rb

class Admin::TodoController < Admin::BaseController
…snip…

def live_search
@search = @params[ :search ] || @request.raw_post
@pages, @items = paginate_collection TodoItem.search( @search,
:include => [ :assigned_to ] ), { :per_page => 15, :page =>
params[:page] }
render :action => ‘live_list’, :layout => false
end

…snip…
end

admin/base_controller.rb

class Admin::BaseController < ApplicationController
… snipped…
end

application.rb

class ApplicationController < ActionController::Base
def paginate_collection(collection, options = {})
default_options = {:per_page => 10, :page => 1}
options = default_options.merge options

pages = Paginator.new self, collection.size, options[:per_page],

options[:page]
first = pages.current.offset
last = [first + options[:per_page], collection.size].min
slice = collection[first…last]
return [pages, slice]
end
end


#2

so this is a bug.

now that i know its a bug, i shall put in a ticket.


#3

i am getting:

NoMethodError in Admin/todo#live_search

Hi Sean. Please use dev.rubyonrails.org to create a ticket for bugs.
Thanks.

David Heinemeier H.
http://www.loudthinking.com – Broadcasting Brain
http://www.basecamphq.com – Online project management
http://www.backpackit.com – Personal information manager
http://www.rubyonrails.com – Web-application framework