だから、私はデータベースのレコードを更新するフォームを持っています。私のコントローラーupdateアクションでは、値の別の1つがである場合、値を何かに変更したいと思いますEstimate。多分これはもっと理にかなっているでしょう...これは私がやろうとしていることです。
def update
@invoice = Invoice.find(params[:id])
if @invoice.update_attributes(params[:invoice])
if@invoice.status == "Estimate"
# if the value of status is Estimate then change the
# value of estimate_sent_date to the current timestamp
end
redirect_to invoices_path
else
render 'edit'
end
end
私が関わっているフォームの唯一の値はとstatusですestimate_sent_date。estimate_sent_dateほとんどの場合、そのレコードの値を変更して保存する方法がわかりません。
また、すべてを保存してから、別の呼び出しを行って保存する必要がありますか、estimate_sent_dateそれとも一度にすべて保存する必要がありますか?estimate_sent_date電話をかける前にの値を変更できると思いif @invoice.update_attributes(params[:invoice])ますよね?
助けてくれてありがとう!