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