我是ROR的初學者,我閱讀7.21章。Ruby on Rails教程第7.21章params [:user]
class UsersController < ApplicationController
.
.
.
def create
@user = User.new(params[:user]) # Not the final implementation!
if @user.save
# Handle a successful save.
else
render 'new'
end
end
end
當提交表單以創建一個新用戶,則params [:用戶]從表格中的信息,並在調試信息獲取的哈希:
"user" => { "name" => "Foo Bar",
"email" => "[email protected]",
"password" => "[FILTERED]",
"password_confirmation" => "[FILTERED]"
}
我konw params爲哈希的散列,但不知道params [:user]的含義。什麼是:用戶的意思是? The:用戶代表用戶模型還是變量名稱?用戶和「用戶」的關係是什麼?