Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

dyohi's Profile

GitHub User: dyohi

Comments by

Avatar

You should also replace total_entries with total_count.

Avatar

Why do you create a Class when you can create the json in the respond_to block? For example:

ruby
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