Created
February 3, 2014 08:38
-
-
Save ostholz/8780588 to your computer and use it in GitHub Desktop.
Strong Parameter in Rails 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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