SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

How to add more attributes after params

Altcademy Team wrote on 7 February 2018

class UsersController < ApplicationController def update user = User.first user.update(user_params) end private def user_params params.require(:user).permit(:name, :email) end end

You can use .merge after the params method.

For example, to add the attribute password you can do user_params.merge(password: 'password').

class UsersController < ApplicationController def update user = User.first user.update(user_params.merge(password: 'password')) end private def user_params params.require(:user).permit(:name, :email) end end

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #111

Enroll for March 2nd, 2026