How does params come into scope in Rails? -
How does params come into scope in Rails? -
in illustration code below new user created based on result of calling method user_params
. method uses params
. how params
variable come scope? not prefixed @
symbol nor user_params
take argument.
class userscontroller < applicationcontroller . . . def create @user = user.new(user_params) if @user.save # handle successful save. else render 'new' end end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end
the params
instance method of class actioncontroller:: metal
.
it extended by class actioncontroller::base
.
ruby-on-rails
Comments
Post a Comment