I need to use params[:number] from the new function in the create function, how would I go about doing this?
def new
@test_suite_run = TestSuiteRun.new
@tests = Test.find(:all, :conditions => { :test_suite_id => params[:number] })
end
def create
@test_suite_run = TestSuiteRun.new(params[:test_suite_run])
@tests = Test.find(:all, :conditions => { :test_suite_id => //I need the same params[:number] here})
end
EDIT: I guess I am confused as the differences between new and create then. I am taking in the parameter :number by passing it to new.
new_test_suite_run_path(:number => ts.id)
I am then using it to generate the form. I don't understand what to do in the create function then. If I remove the create function in the controller, when I submit the form in new, it gives me an error saying that there is no create action in the controller. Does that mean I have to move everything in new to the create function? How would that be possible, would I have to create a create.html.erb and move all my form information?
newandcreatefunction :/ seems like you would need to pass in the original:numberparameter into both functions from the same place