I’d like to be able to display my ‘new’ view but have an intermediate
step before saving the new record using the ‘create’ button. Basically,
some of the data for the model is variable and dependant on a number
that the user needs to select. I envisaged a button along the lines of
‘go get the extra data’ that would head off to the controller which
would get the data based on the number entered by the user and redirect
back to the new page (which preserved the info they already entered).
The user could then make sure they are happy with this new information
before they hit create.
So far i’ve taken the scaffolded new.html.erb file and tried to add a
‘button_to’ that has an :action that contains the name of a method i
added to the controller. But the method doesn’t get hit - it calls
Create instead. I think its because its wrapped in the form_for the
scaffold generated. I’ve managed to confuse myself and i couldn’t find a
tutorial to help.
I’ve described it in general terms and hopefully this makes sense. I
dont have the code at work and if need be i can post back later with it.