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 6943781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:12:04+00:00 2026-05-27T13:12:04+00:00

I have a wizard that is responsible for creating 3 different types of resources.

  • 0

I have a wizard that is responsible for creating 3 different types of resources. When the user completes the wizard, the user hits submit and an ajax POST is sent to create the 3 new entries. These 3 resources all belong_to User. I was wondering if I should POST 1 ajax request to the User controller containing details of all 3 resources, or if I should POST 3 separate ajax requests to each resource’s controller. What’s the proper way to do this? Thanks!

  • 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-27T13:12:05+00:00Added an answer on May 27, 2026 at 1:12 pm

    Firstly, a minor correction: you cannot post a request to a resource model. I believe what you are talking about is posting to the models’ respective controllers (which I presume to exist).

    If you have a single form for the wizard, then as you understand it, it will post one single time. Why not work with that? But before we go with that, let’s address the alternative.

    What you are suggesting, starting 3 ajax requests, brings in more problems than it solves. For example, what if there is an error in one of the requests? How do you cancel the other two, if you want to follow the principle of atomicity. There may be other reasons why such a design consideration is going to be a bad one, but I think this is trouble enough. Let’s move on to how we can handle this.

    The controller that is responsible for the wizard’s form should provide a bit more logic to handle the 3 additional resources. If the types of resources are similar, you could be using single-table-inheritance or something to simplify some of the controller code, but that’s not so relevant. We will assume that the resources are not similar at all.

    Simply put, you could build the form as a multi-model form. If users can create multiple entries of each type of resource then you will have a form that creates multiple child models.

    If you only need one of each resource, then the answer is really simple, just use the accepts_nested_attributes_for method for each type of resource in your User model and the fields_for method in your views.

    If you need multiple of each resource, then perhaps you may wish to find out more about multiple children models in a form.

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

Sidebar

Related Questions

I am creating a form wizard that guides the user through each form element,
I have an app that I'm writing a little wizard for. It automated a
I have got a form that posts values to a page in a wizard.
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
Good Afternoon All, I have a wizard control that contains 20 textboxes for part
I have a wizard with several screens where user has to fill his/her details
I have a Wizard model that the client references w/o an ID (it's saved
I'm creating a wizard-based series of forms for taking user inputs. One of the
I have a p:wizard with some tabs. In the first tab, the user selects
I have a Wizard that i display in a ModalPopupExtender when a button New

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.