Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rails アプリケーションで new メソッド (例: users/new) と edit メソッド (users/edit) を呼び出すと、Rails はバックグラウンドで何をしますか? 新しいものは作成につながり、編集は更新につながりますか?
を使用する場合、Rails は、オブジェクトのメソッドを呼び出して、(またはアクション<%= form_for @user do |f| %>に導くために) 使用する URL と HTTP メソッドを決定します。が返された場合、フォームが生成されます。である場合、フォームはアクションにつながります。createupdatepersisted?@userfalsecreatetrueupdate
<%= form_for @user do |f| %>
create
update
persisted?
@user
false
true