Sha256: fedfcc90c749fd8c7d356a2e8a111e2c510496487d9841e187f1a2efeaa27a94
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 Bytes
Contents
require_dependency "blogr/application_controller" module Blogr class UsersController < ApplicationController before_action :set_user, only: [:edit, :update, :destroy] def index @title = "Users" @users = Blogr::User.all end def new @title = "New User" @user = User.new end def edit @title = "Editing '#{@user.username}'" end def create @user = User.new(user_params) if @user.save redirect_to users_path, notice: "User was successfully created" else render action: "new" end end def update if @user.update(user_params) redirect_to users_path, notice: "User was successfully updated" else render action: "edit" end end def destroy @user.destroy redirect_to users_path, notice: "User was successfully destroyed" end private def set_user @user = User.find(params[:id]) end def user_params params.require(:user).permit(:first_name, :last_name, :username, :email, :password, :password_confirmation) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blogr-0.0.7 | app/controllers/blogr/users_controller.rb |
blogr-0.0.6 | app/controllers/blogr/users_controller.rb |