您正在被重定向.导轨 3.1 [英] You are being redirected. rails 3.1

查看:39
本文介绍了您正在被重定向.导轨 3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的脚手架,它有销毁方法

I created simple scaffold, it has the destroy method with

respond_to do |format|
  format.html { redirect_to :action => "index", :status => 302  }
  format.json { head :ok }
end

结束

当我点击销毁"时,我看到页面上写着您正在被重定向".其中重定向"一词是指向posts_path 的链接.我应该怎么做才能修复这个错误?

when I click "Destroy", I see the page with words "You are being redirected." where word "redirected" is link to the posts_path. what should i do to fix this bug?

推荐答案

我会取出 :status =>302' 选项并仔细检查我的销毁链接是否已设置:method => 'delete'set.如果未在链接上设置:method`,那么您将被重定向到您的索引操作.

I would pull out the :status => 302' option and double check that my Destroy link has:method => 'delete'set. If the:method` isn't set on the link then you will be redirected to your index action.

这篇关于您正在被重定向.导轨 3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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