Apologies for what is a very basic question, but hopefully someone can
help me understand why the following is done in the Rails scaffolding:
Scaffolding creates, amongst others, these two methods in a controller:
‘new’ renders the ‘make new x record’ page. And ‘create’ deals with the
data sent back from the form on that page.
My question is - why does ‘new’ bother to create a new model object at
all? It’s not used in the rhtml template, and a new model object is
created as another new instance in ‘create’ anyway.
Scaffold methods for reference:
@paper = Paper.new
@paper = Paper.new(params[:paper])
flash[:notice] = ‘Paper was successfully created.’
redirect_to :action => ‘list’
render :action => ‘new’
Thanks for your insight, apologies again for what I’m assuming is a dumb