RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: dyohi
You should also replace total_entries with total_count.
Why do you create a Class when you can create the json in the respond_to block? For example:
respond_to do |format| format.html format.json do render :json=>{ "iTotalRecords"=>@products.count, "iTotalDisplayRecords"=>@products.count, "aaData"=>@users.as_json( :only=>[:name, :category, :released_on, :price] ) } end end
You should also replace total_entries with total_count.
Why do you create a Class when you can create the json in the respond_to block? For example: