Undefined method 'total_entries' after upgrading Rails 2.2.2 to 2.3.5

Posted by Trevor on Stack Overflow See other posts from Stack Overflow or by Trevor
Published on 2010-05-17T15:16:45Z Indexed on 2010/05/17 15:20 UTC
Read the original article Hit count: 215

I am upgrading a Rails application from 2.2.2 to 2.3.5. The only remaining error is when I invoke total_entries for creating a jqgrid.

Error:

NoMethodError (undefined method `total_entries' for #<Array:0xbbe9ab0>)

Code snippet:

@route = Route.find(
  :all,
  :conditions => "id in (#{params[:id]})"
) {
  if params[:page].present? then
    paginate :page => params[:page], :per_page => params[:rows]
    order_by "#{params[:sidx]} #{params[:sord]}"
  end
}

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @route }
  format.json  { render :json => @route }
  format.jgrid {
    render :json => @route.to_jqgrid_json(
      [
        :id, :name
      ],
      params[:page],
      params[:rows],
      @route.total_entries
    )
  }
end

Any ideas? Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about will-paginate