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

  • SEARCH
  • Home
  • 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 6063729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:12:03+00:00 2026-05-23T09:12:03+00:00

I have a form that a user submits. The form is for a user.

  • 0

I have a form that a user submits. The form is for a user. I have the following in my routes.rb file:

 resources :users, :except => [:new]

  root :to => 'pages#home'
  match '/contact', :to => 'pages#contact'
  match '/about',   :to => 'pages#about'
  match '/help',    :to => 'pages#help'

In the users_controller.rb:

  def create
    @title = "Home"
    @user = User.new(params[:user])
    respond_to do |format|
      if @user.save
        format.html { redirect_to user_path(@user), :flash => {:success => "Your friend's details have been saved.The surprise has begin"} }
        format.js
      else
        format.html { render :template => 'pages/home'}
        format.js
      end
    end
  end

This form is being submitted with a regular POST request and not Ajax.

I want to know why the Update template is being requested after the form is successfully submitted instead of the Show.

The output from rake routes is as follows:

    users GET    /users(.:format)          {:action=>"index", :controller=>"users"}
          POST   /users(.:format)          {:action=>"create", :controller=>"users"}
edit_user GET    /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
     user GET    /users/:id(.:format)      {:action=>"show", :controller=>"users"}
          PUT    /users/:id(.:format)      {:action=>"update", :controller=>"users"}
          DELETE /users/:id(.:format)      {:action=>"destroy", :controller=>"users"}
     root        /(.:format)               {:controller=>"pages", :action=>"home"}
  contact        /contact(.:format)        {:controller=>"pages", :action=>"contact"}
    about        /about(.:format)          {:controller=>"pages", :action=>"about"}
     help        /help(.:format)           {:controller=>"pages", :action=>"help"}

Thanks in advance.

  • 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-23T09:12:03+00:00Added an answer on May 23, 2026 at 9:12 am

    What is the code for the controller and view of this form? Is there an existing user object when you generate the form or do you create a new user object (ie. @user = User.new in your controller)? If there is an existing user then the form will submit to update.

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

Sidebar

Related Questions

I have a form that submits user inputs to the following php script (i've
I have a rails app with the following routes root :to => pages#home scope
My website needs to have a form that automatically submits, sending the user (with
I have the following code that executes when a form submits: $('input[value=enter highlight]').val(''); Essentially,
I have a general create function that submits a new user to the database
So I have a form that accepts some input from a user that may
We have a form that allows a user to filter a list with by
I have a form that allows a user to import a spreadsheet. This spreadsheet
I currently have form that checks if a user has unsubmitted changes when they
In my current application I have a form that requires the user to enter

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.