rails 4 中的未知格式 [英] Unknown format in rails 4
本文介绍了rails 4 中的未知格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 rails 4.但我收到了未知的格式错误.你们对我有什么帮助吗.这是我的控制器:
I'm using rails 4. But I am getting unknown format error. Do you guys have any help for me. Here is my controller:
class EntriesController < ApplicationController
respond_to :json
def index
respond_with Entry.all
end
end
推荐答案
将此添加到您的路由配置
Add this to your routes config
resources :entries, defaults: { format: 'json' }
这篇关于rails 4 中的未知格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文