Rails RoutingError(没有路线匹配[OPTIONS]

编程入门 行业动态 更新时间:2024-10-07 12:26:55
本文介绍了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:

github/cyu/rack-cors

更多推荐

Rails RoutingError(没有路线匹配[OPTIONS]

本文发布于:2023-11-25 21:35:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631435.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路线   Rails   RoutingError   OPTIONS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!