Ruby on rails Rails和Sencha嵌套JSON:有很多是通过的吗?

Ruby on rails Rails和Sencha嵌套JSON:有很多是通过的吗?,ruby-on-rails,json,nested,associations,sencha-touch,Ruby On Rails,Json,Nested,Associations,Sencha Touch,我想在Sencha中处理从rails发送的嵌套JSON数据 在rails中,我的模型关联是: class User < ActiveRecord::Base has_many :codes has_many :stores, :through => :codes, :uniq => true class Store < ActiveRecord::Base has_many :deals has_many :orders has_many :rewards has

我想在Sencha中处理从rails发送的嵌套JSON数据

在rails中,我的模型关联是:

class User < ActiveRecord::Base

has_many :codes
has_many :stores, :through => :codes, :uniq => true


class Store < ActiveRecord::Base

has_many :deals
has_many :orders
has_many :rewards
has_many :codes
has_many :users, :through => :codes, :uniq => true

class Code < ActiveRecord::Base
validates :unique_code, :uniqueness => true
belongs_to :store
belongs_to :order
belongs_to :user
belongs_to :earn
但是,如何处理Sencha中的嵌套结构?我的目标基本上是拥有一个列表面板,首先列出并显示用户订阅的商店,单击时,加载关系的详细信息,例如商店当前提供的交易和奖励

我在Sencha看不到“有很多”关系的选择


谢谢你的帮助。

我恐怕目前在Sencha Touch中没有类似的功能,而且正如你所说的,还有网络的影响需要考虑。您现在可能只需要创建自己的自定义代理或数据加载例程。恐怕这不是一个很好的答案。

注意:我当然可以为获取数据的每一步都使用一个新的AjaxProxy,但我知道这对于网络考虑(尤其是3G)来说可能是个坏主意。
@user.to_json(:include => :stores, :deals, :rewards) (not proper code)