Skip to content

Instantly share code, notes, and snippets.

@ostholz
Created February 3, 2014 08:38
Show Gist options
  • Save ostholz/8780588 to your computer and use it in GitHub Desktop.
Save ostholz/8780588 to your computer and use it in GitHub Desktop.
Strong Parameter in Rails 4
def UsersController < ActionController::Base
def update
@user = current_user
if @user.update_attributes(user_profile_parameters)
redirect_to home_path, notice: "Your profile has been successfully updated."
else
render action: "edit"
end
end
private
def user_profile_parameters
params.require(:user).permit(:name, :password, :password_confirmation, :email)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment