23411

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

  • Ruby on Rails NoMethodError in Posts#show
  • Does derived class' member functions inherit virtualness from base class?
  • yii2 create translated URLs
  • Getting webGL error in autodesk viewer
  • Is there a way to clear some session data from ALL sessions?
  • PHPUnit: Expected status code 200 but received 419 with Laravel
  • Index.php as custom error page
  • help('modules') crashing? Not sure how to fix
  • Can XOR be expressed using SKI combinators?
  • read values from form post in jquery or javascript
  • jQuery: How to AJAXify WordPress Search?
  • Checking if an array in C is symmetric
  • Mysql - How to search for 26 records that each begins with the letter of the alphabet?
  • Webgrid not refreshing after delete MVC
  • Declaring variable dynamically in VB.net
  • How to match http request and response using Jersey ContainerRequestFilter and ContainerResponseFilt
  • How do I open a C file with a relative path?
  • Use of this Javascript
  • Jquery UI tool tip close icon
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Recording logins for password protected directories
  • Linq Objects Group By & Sum
  • Splitting given String into two variables - php
  • Different response to non-authenticated users and AJAX calls
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Check if a string to interpolate provides expected placeholders
  • Join two tables and save into third-sql
  • htaccess rewriting URLs with multiple forward slashes
  • Display Images one by one with next and previous functionality
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • Traverse Array and Display in markup
  • How to format a variable of double type
  • Data Validation Drop Down Box Arrow Disappearing
  • PHP: When would you need the self:: keyword?
  • A cron job substitute?
  • Buffer size for converting unsigned long to string
  • How do you join a server to an Active Directory (domain)?
  • Qt: Run a script BEFORE make
  • Does armcc optimizes non-volatile variables with -O0?