Hi everyone
I have a problem with a couple of methods I’ve created.
The first method looks like the “edit” method but I’ve renamed to
“aprove” this method load a form with some editable fields
def aprove
@buy_order = BuyOrder.find(params[:id])
end
The second method looks like “update”, the name is “result”, but it
should execute just after I click “submit” in the aprove form. But
when I click “submit”… the “update” method is executed instead
def result
@buy_order = BuyOrder.find(params[:id])
respond_to do |format|
if @buy_order.update_attributes(params[:buy_order])
format.html { redirect_to(@buy_order) }
format.xml { head :ok }
else
format.html { render :action => “aprobar”}
format.xml { render :xml => @buy_order.errors, :status
=> :unprocessable_entity }
end
end
end
What I have to do to make this work correctly? (correctly is: when I
click “submit” in the form for “aprove” then “result” has to execute)
Can you help me?