Rails RoutingError(没有路由匹配 [OPTIONS] [英] Rails RoutingError (No route matches [OPTIONS]

查看:28
本文介绍了Rails RoutingError(没有路由匹配 [OPTIONS]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 rails 创建一个 rest api,并使用 ember 数据从远程 ember 应用程序进行调用.我在什么应该是 GET 请求上收到此路由错误.我如何创建 OPTIONS 方法,我是否必须为每个资源都这样做?

I'm creating a rest api using rails and making calls from a remote ember app using ember data. I'm getting this routing error on what should be a GET request. How do I create an OPTIONS method and will I have to do this for every resource?

如果需要,我可以提供代码片段.

I can provide code snippets if needed.

推荐答案

安装和配置这个 gem 应该能让你的 Rails 应用程序正确处理由 CORS 引起的选项请求:

Installing and configuring this gem should allow your Rails application to properly process the options request caused by CORS:

https://github.com/cyu/rack-cors

这篇关于Rails RoutingError(没有路由匹配 [OPTIONS]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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