Skip to content

Instantly share code, notes, and snippets.

@BrianJoyce
Last active August 29, 2015 13:56
Show Gist options
  • Save BrianJoyce/9324381 to your computer and use it in GitHub Desktop.
Save BrianJoyce/9324381 to your computer and use it in GitHub Desktop.
user_controller.rb
class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit]
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
redirect_to @user, notice: "Thank you for signing up"
else
render 'new'
end
end
private
def set_user
@user = User.find(params[:id])
end
def user_params
params.require(:user).permit(:username,:name,:email,:password, :password_confirmation,:avatar_url)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment