ruby-on-rails – Rails:如何为redirect_to设置json格式
发布时间:2020-12-16 19:34:37 所属栏目:百科 来源:网络整理
导读:我怎样才能重定向到html格式而不是json? 我想要这样的东西: redirect_to user_path(@user),format: :json 但这不起作用,我仍然重定向到html路径. 解决方法 我读了一些apidock ……这很简单.我应该在路径助手中指定格式,如下所示: redirect_to user_path(@
我怎样才能重定向到html格式而不是json?
我想要这样的东西: redirect_to user_path(@user),format: :json 但这不起作用,我仍然重定向到html路径. 解决方法
我读了一些apidock ……这很简单.我应该在路径助手中指定格式,如下所示:
redirect_to user_path(@user,format: :json) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |