I'm a beginner of ROR, I read chapter 7.21.
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
When submit a form to create a new user, params[:user] get the information from the form, and get a hash in debug info:
"user" => { "name" => "Foo Bar",
"email" => "foo@invalid",
"password" => "[FILTERED]",
"password_confirmation" => "[FILTERED]"
}
I konw params is a hash of hash, but don't know the meaning of params[:user]. What's :user mean? The :user represent the User model or just a variable name ? What is the relationship of :user and "user" ?