에 대한 정의되지 않은 메소드 paginate '그래서 나는 bundler가있는 2.3.11 레일을 사용하고 있으며, will_paginate가 작동하도록하는 데 가장 많은 시간을 보내고 있습니다. 그것의 반환 다음과 같은 오류 : # < 클래스에 대한rails 2, Will_paginate, # <class :
정의되지 않은 메서드`PAGINATE '...
def show
@category = Category.find_by_url_name(params[:id])
@brands = @category.brands.find(:all, :order => "name")
@categories = Category.find(:all)
@meta_title = "#{@category.name}"
respond_to do |format|
format.html do |wants|
@brand = @brands.first
@products = Product.paginate(:page => params[:page], :per_page => 6, :conditions => ['brand_id = ? AND category_id = ?', @brand.id, @category.id])
render :template => 'brands/show'
end
format.xml { render :xml => @category }
end
end
이 내 컨트롤러 액션입니다. 전체 오류 :
NoMethodError in CategoriesController#show
undefined method `paginate' for #<Class:0x1034703e8>
RAILS_ROOT: /Users/tjs/Sites/emeraldcg
Application Trace | Framework Trace | Full Trace
/Users/tjs/.rvm/gems/ruby-1.8.7-p352/gems/activerecord-2.3.11/lib/active_record/base.rb:1998:in `method_missing'
/Users/tjs/Sites/emeraldcg/app/controllers/categories_controller.rb:28:in `show'
/Users/tjs/Sites/emeraldcg/app/controllers/categories_controller.rb:25:in `show'
Request
Parameters:
{"id"=>"acoustic-guitars"}
Show session dump
Response
Headers:
{"Content-Type"=>"text/html",
"Cache-Control"=>"no-cache"}
내 gemfile 꽤 정직 :
# A sample Gemfile
source "http://rubygems.org"
# gem "rails"
gem "rails", '2.3.11'
gem "rake"
gem "RedCloth", ">=4.2.2"
gem "will_paginate", "~> 2.3.16"
group :development do
gem "mysql"
gem "capistrano"
gem "capistrano-ext"
end
group :test do
gem "sqlite3"
end
이이 배열되고 있지만, 왜 클래스의 방법으로 실패로 인해 실패 할 경우 이해 것
?
도움 주셔서 감사합니다.
Steenhouwer, 메모 주셔서 감사합니다. 내가 봤다고 생각했던 것. 이 때문에 부러진 고객 사이트가 있습니다. 저는 특정 will_paginate 버전을 제거하고 3.0.2 버전을 사용했습니다. .all 메서드를 전달하면 Class를 여전히 실패한 배열로 변환하는 것으로 보입니다. 그것은 클래스 대신 Array의 정의되지 않은 메서드로 실패합니다. 다른 페이지 매김 추천? –
오래된 git 커밋을 체크 아웃하고 오래된 will_paginate 플러그인을 잡아서 ... bundler 조각이 작동하지 않을 것입니다. Mislav는 will_paginate 위키 문제 해결을 참조하여 실행할 수있는 콘솔 명령이 두 가지 있음을 지적합니다. will_paginate가로드되지 않은 것으로 밝혀졌습니다. will_paginate wiki에 뭔가를 게시 할 것입니다. –