Skip to content

primary0/Ext-Json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExtJson

Output ExtJS 3.X friendly JSON using respond_with.

Setup

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

Usage

Sample index method:
@posts = Post.all
respond_with @posts.ext_json

Sample output for the above method:
{"data" : [{"title" : "First Post"}, {"title" : "Second Post"}], "total":2}

2011 Mohamed Ashraf – MIT license

About

Ext JS friendly JSON output using respond_with

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages