Output ExtJS 3.X friendly JSON using respond_with.
Install the plugin:rails plugin install git://github.com/primary0/Ext-Json.git
In your environment.rb set “include_root_in_json” to “false”:ActiveRecord::Base.include_root_in_json = false
Set the “root” attribute of your Ext Datasource to “data”.
Add the following to your controllers.respond_to :json
Sample index method:@posts = Post.allrespond_with @posts.ext_json
Sample output for the above method:{"data" : [{"title" : "First Post"}, {"title" : "Second Post"}], "total":2}
2011 Mohamed Ashraf – MIT license