Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6227917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:18:00+00:00 2026-05-24T09:18:00+00:00

Using Rails 3.0.9, I’m trying to redirect after a post to the create method

  • 0

Using Rails 3.0.9, I’m trying to redirect after a post to the create method in UserController, Firebug shows the POST is sent correctly, my create method is executed, POST returns ‘302’ moved temporarily. As expected the, GET request routes to the new action of the UserProfileController, HOWEVER, there is not response to the GET request!

I tried this with other controllers/actions also with the same result. Why is the GET request after redirect empty? What am I doing wrong? A standard request to /users/profile/new does return the expected GET response.

UserController

def create
  @user = User.new(params[:user]) if params[:user]
  logger.debug (params[:user])
  logger.debug @user
  logger.debug @user.valid?
  logger.debug @user.errors

  if(@user.valid?)
    session[:new_user] = @user

    logger.debug "Creating User Profile"
  end

  redirect_to new_user_profile_url  # controller => user_profile, action => new
end

UserProfileController

def new
  @user_profile = UserProfile.new

  # check to see if the new user is in session, if not, then redirect to previous page
  user = session[:new_user]

  logger.debug 'going to right url???'
  logger.debug request.method
  logger.debug request.format
  logger.debug request.headers
  logger.debug request.url

  respond_to do |format|
    format.html
    format.xml { render :xml => @user_profile }
  end
end

Server Log

Creating User Profile
Redirected to http://localhost:3000/users/profile/new
Completed 302 Found in 325ms


Started GET "/users/profile/new" for 127.0.0.1 at Fri Aug 05 10:38:38 -0500 2011
  Processing by UserProfileController#new as HTML
going to right url???
GET
text/html
http://localhost:3000/users/profile/new
Rendered shared/_trust_reports.haml (45.0ms)
Rendered user_profile/new.haml within layouts/application (590.0ms)
Completed 200 OK in 973ms (Views: 616.0ms | ActiveRecord: 0.0ms)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:18:01+00:00Added an answer on May 24, 2026 at 9:18 am

    Turns out it was my own mistake, I did not realize the javascript/theme we were using defaulted to submit all forms via ajax. After changing the default behavior, it worked as expected, thanks for the suggestion Fabio.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails I'm trying to get an error message like The song field can't
I'm using Rails 3 beta 4 and trying to include ActionController::UrlWriter in my model,
I'm using Rails 3 w/ Mongoid, (so no ActiveRecord). Mongoid uses ActiveModel's to_json method,
Using Rails 3.1.0 def create @practice = Practice.new(params[:practice]) respond_to do |format| if (current_user.practices <<
I'm using Rails' accepts_nested_attributes_for method with great success, but how can I have it
Using Rails 3.0.7. I have a simple form which shows all records from one
I am using Rails 3.0.7 and I am trying to follow this Railscast: http://railscasts.com/episodes/182-cropping-images
Using Rails 3.0.5, RSpec 2 and Capybara 0.4.1.2 and I'am trying to write a
using Rails 3.1.0.rc4, I'm trying to access a route helper in a javascript file
NOTE: Using Rails 3.0.7, Postgresql 8.4.4-1, rake 0.8.7. Trying to get rails testing working.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.