我正在尝试对我的项目模型进行分页(will_paginate gem),该模型有很多注释(acts_as_commentable_with_threading gem):
@root_comments = @project.root_comments.paginate(:per_page => 2, :page => params[:discussions_page])
堆栈追踪:
NoMethodError - undefined method `total_pages' for #<Comment::ActiveRecord_AssociationRelation:0x007fa183d77ce8>:
activerecord (4.1.4) lib/active_record/relation/delegation.rb:136:in `method_missing'
activerecord (4.1.4) lib/active_record/relation/delegation.rb:99:in `method_missing'
will_paginate (3.0.5) lib/will_paginate/view_helpers.rb:73:in `will_paginate'
will_paginate (3.0.5) lib/will_paginate/view_helpers/action_view.rb:33:in `will_paginate'
知道我为什么会收到错误?
<%= will_paginate @root_comments,:param_name => 'discussions_page', renderer: BootstrapPagination::Rails %>