- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
这里发生了什么?我正在尝试通过使用 JSON 数据类型的 ajax 调用添加数据。但每次我尝试添加数据时,它都会显示错误,如图所示。
我认为它总是响应html格式但不响应json格式。
def new
@batch = Batch.new
respond_to do |format|
format.json
format.html
end
end
def create
@batch = Batch.new(batch_param)
puts "/n/n/n/n name: #{@batch.name} /n/n/n/n"
respond_to do |format|
if @batch.save
format.json { render json: @batch, status: :created, location: @batch }
format.html { redirect_to @batch, notice: "Save process completed!" }
else
format.html {
flash.now[:notice]="Save proccess coudn't be completed!"
render :new
}
format.json { render json: @batch.errors, status: :unprocessable_entity}
end
end
end
最佳答案
这只是折旧警告,如果您将应用程序升级到 Rails 5.1
,它可能会变成错误,正如日志中明确提到的那样,您可以通过搜索您正在使用 的 Controller 来解决它>before_filter
并将其替换为 before_action
。
before_action
与早期版本的 Rails 中的 before_filter
做同样的事情(在请求命中 Controller 中的操作之前运行一些代码)。
关于ruby-on-rails - 弃用警告 : before_filter is deprecated and will be removed in Rails 5. 1. 改用 before_action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41572287/
所以,我有一个 Python 脚本,基本上可以写入 80GB 以上的文件。目前它只是串行运行,在服务器上运行大约需要 13 个小时,这是我唯一一次实际运行它。 我打算将它并行化,以便它写入多个文件,而
我最近将 ASP.Net Web API 项目部署到我们的 Azure 应用服务测试槽,但在向 API 端点发出请求时开始收到错误。通过远程调试,很明显该应用正在从部署的 web.config 文件中
为什么我在 android 的 xml 布局中有这个警告消息 信息是避免使用“px”作为单位,改用“dp” 最佳答案 答案就在那里:What is the difference between "px
我正在使用 Symfony 2.3,并且在我的分析器中有与 Twig 相关的弃用警告。如: DEPRECATION - Using "replace" with character by charac
这个问题在这里已经有了答案: Convert pandas dataframe to NumPy array (15 个答案) 关闭 3 年前。 我有以下代码 train_X, test_X, tr
我正在尝试在 Storyboard完成后运行一些代码,但似乎找不到如何设置它...如果我只是这样做 Completed="LoadingStoryBoard_Completed" 在 Storyboa
我最近使用 ng update 更新了我的 Angular 版本并且在运行 ng lint 时 我收到错误 create is deprecated: use new Observable() ins
我将 webpacker 从 4.x 升级到 5.2.1 并开始收到此警告: The resolved_paths option has been deprecated. Use additional
我正在编译一些 C 代码,但出现错误 typedef 'A' is initialized (use decltype instead) 在我的结构声明之一。什么可能导致这种情况? 最佳答案 我可以用
打开 GUI 的简单程序,单击一个按钮设置 curDir,单击另一个按钮设置 savDir,第三个按钮执行一些 C++ 代码,类似于 ls -l curDir > savDir.txt 我的一个 Qt
我要git diff成为一个快速的命令行解决方案来查看两个文件之间的差异,然后我想要 git difftool启动 meld 以获得文件差异的更多图形 View 。 目前,git diff完全按照我的
我正在尝试构建一个 webpack 解析器,下面的 .plugin 方法代码似乎已被弃用,我找不到使用 .hooks 的类似方法调用。 module.exports = class Resolver
我最近在运行我的应用程序时开始收到此错误。它似乎不会影响一切,但它在日志中非常嘈杂和烦人。我没有对我的应用程序进行任何更改或添加任何会导致此类问题的内容,我最近所做的唯一一件事就是升级到最新版本的 F
我想用 Python mongodb 查询,但“DeprecationWarning: count is deprecated。改用 Collection.count_documents。”给出这样的
代码: export default { props: { article: {type: Object} }, data () { retur
这让我发疯。我想读取一些文本文件(位于我的项目目录之外),用 Windows-1252 编码,将它们编辑为字符串,然后写回这些文件,再次作为 Windows-1252。然而,Visual Studio
我需要一点帮助。因为 preg_replace 已弃用,我必须将所有 my preg_replace 转换为 preg_replace_callback... 我尝试过的: 改变: $template
简短的例子: #include #include using namespace boost; template BOOST_TYPEOF_TPL(T() + U()) add2(const T&
我尝试运行 Vuetify VueJS Cordova example但是在 npm run dev 之后出现了这个错误 node build/dev-server.js Starting dev s
我有以下代码: func setupShortcutItems(launchOptions: [NSObject: AnyObject]?) -> Bool { var shouldPerfo
我是一名优秀的程序员,十分优秀!