Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Panos Malliakoudis
Courses Plus Student 4,720 PointsNested Forms with Devise/Simple_Form/Rails 4.0
Hello there, this is my first post on this forums. First of all here is what I use for my project.
Simple_Form: 3.0.0 Devise: 3.2.2 Rails: 4 Ruby: 2 Bootstrap: 3.0.3
I have a User model (from devise) and a part_order model (which has user_id as index), i set the user_id value in part_order create method like this '@part_order.user_id = current_user.id' not sure if its proper but it works fine.
Here is the problem:
The client wants an unregistered user to make a part order (create a part_order) and sign up (create a user)/ sign in (if he already an account) in the same page. I know that it has to do something with nested forms and attributes.
I am in early stage of the project so i didn't make any changes on the code (after the gems' installation).
Thanks in advance!
1 Answer
Jason Seifer
Treehouse Guest TeacherHey Panos Malliakoudis this is a bit of a challenge. Typically this is done by storing their part order in the session and then assigning it during the login process. If the user has never registered, you would keep it in the session and assign the part order after they complete the sign up process. You can then redirect them back to the order page once that's completed.