2013-02-06 1 views

답변

2

하나 개의 솔루션 (NO 최고)는 before_filter

controller do 
    before_filter :disable_pagination, :only => [:index] 

    def disable_pagination 
    @per_page = YourModel.count 
    end 
end 

이 모든 레코드에 대해 하나의 페이지와 페이지 매김을 가진 비활성화 드 페이지 매김, 그래서 모든 레코드를 내보낼 예정이다.

0

이도 같이 수행 할 수 있습니다,

controller do 
    def index 
     super do |format| 
     per_page = (request.format == 'text/html') ? 30 : 10_000 # to skip the pagination 
     params[:page] = nil unless (request.format == 'text/html') #It will be working even after we export the CSV on the paginated sections. 
     @users = @users.order("first_name asc, last_name asc").page(params[:page]).per(per_page) 
     @users ||= end_of_association_chain.paginate if @users.present? 
     end 
    end 
end