Sencha Touch Rails 3.1 [英] Sencha Touch Rails 3.1

查看:151
本文介绍了Sencha Touch Rails 3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 启动选项

我正在尝试使用sencha touch加载资源,但是我收到以下错误: /menu_items.json?_dc=1322512349038&limit=25&sort=%5B%7B%22property%22%3A%22name%22%2C%22direction%22%3A%22ASC%22%7D%5Dfor 127.0.0.1在2011-11-28 18:32:29 -0200

ActionController :: RoutingError(无路由匹配[OPTIONS]/menu_items.json):

我的商店代码:

  data.Store({
model:'MenuItem',
sorters:'name',
getGroupString:function(r){
return r.get('name')[ 0] ||;
},
proxy:{
type:'rest',
url:'http:// localhost:3000 / menu_items',
格式:'json',
reader:{
type:'json',
root:'menu_item'
}
},
listeners:{
load:{fn:this.initializeData,scope:this}
}
} )


解决方案

OPTION 请求是跨原始资源共享(CORS)协议的一部分。检查这个有价值的帖子。您可以使用 rack-cors gem轻松配置。


I'm trying to load a resource with sencha touch on rails but i get the following error:

Started OPTIONS "/menu_items.json?_dc=1322512349038&limit=25&sort=%5B%7B%22property%22%3A%22name%22%2C%22direction%22%3A%22ASC%22%7D%5D" for 127.0.0.1 at 2011-11-28 18:32:29 -0200

ActionController::RoutingError (No route matches [OPTIONS] "/menu_items.json"):

My store code:

new Ext.data.Store({
                model: 'MenuItem',
                sorters: 'name',
                getGroupString: function(r){
                    return r.get('name')[0] || "";
                },
                proxy: {
                    type: 'rest',
                    url: 'http://localhost:3000/menu_items',
                    format: 'json',
                    reader: {
                        type: 'json',
                        root: 'menu_item'
                    }
                },
                listeners: {
                    load: { fn: this.initializeData, scope: this }
                }
            })

解决方案

The OPTION request is part of the Cross-Origin Resource Sharing (CORS) protocol. Check this valuable post about it. You can use the rack-cors gem to easily configure it.

这篇关于Sencha Touch Rails 3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆