puts 'newbie question'
I have an account sign-up that spans multiple pages, but I'm not exactly wrapping my head around creating a new instance that is tied to a database but only adds to the database if all pages are completed.
I have three actions:
def index
@ticket = Ticket.new
end
def signup_a
end
def signup_b
end
The index page only collects a single text field, then passes th开发者_如何转开发at to populate the field in signup_a, then to b, which is where the record is finally added to the database. How do I go from passing the variable from index to A to B in a Ticket object without actually adding it to the DB?
Edit---
I think I got tripped up that the line
if @order.save
actually saves the object...I thought it just performed a check.
You can keep it in the session and save it in the database once all the steps are complete .
精彩评论