You are being redirected. rails 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

end

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?

Answer1:

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.

Answer2:

I know this question is old, but I found the comment from Robert Reiz on the question helped me solve the same issue. I use the gem decent_exposure, and I had a model called Location. In the controller, expose(:location) creates a method that breaks the redirect. Location is now Place.

Answer3:

If you are using nginx with rails. Add the config below to nginx.

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off;

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:You are being redirected. rails 3.1