2015-07-08 15:17:37 -04:00
|
|
|
class UsersController < ApplicationController
|
2015-08-06 15:10:31 -04:00
|
|
|
def show
|
|
|
|
@user = User.friendly.find(params[:id])
|
|
|
|
@comments = @user.comments
|
|
|
|
end
|
|
|
|
|
2015-07-08 15:17:37 -04:00
|
|
|
def new
|
|
|
|
@user = User.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@user = User.new(user_params)
|
|
|
|
|
|
|
|
if @user.save
|
2015-07-10 15:20:46 -04:00
|
|
|
redirect_to signin_path, notice: 'Your user account has been created'
|
2015-07-08 15:17:37 -04:00
|
|
|
else
|
|
|
|
render :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def user_params
|
|
|
|
params.require(:user).permit(:username, :password, :email)
|
|
|
|
end
|
|
|
|
end
|