Sha256: 6bc951641bdeae77940e2f2ae8e1dae0714ad3d072e19634dede9c2a2318cac9

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

class Admin::UsersController < Admin::AdminController
  def index
    @users = User.all
  end

  def show
    @user = User.find(params[:id])
  end

  def new
    @user = User.new
  end

  def create
    @user = User.create(params[:user])
    if @user
      flash[:notice] = 'User created'
      redirect_to admin_users_path
    else
      render :action => 'new'
    end
  end

  def edit
    @user = User.find(params[:id])
  end

  def update
    
    @user = User.find(params[:id])
    
    
    if @user.update_attributes(params[:user])
      flash[:notice] = 'User updated'
      redirect_to admin_users_path
    else
      render :action => 'edit'
    end

  end

  def destroy
    User.find(params[:id]).destroy
    flash[:notice] = 'User deleted'
    redirect_to admin_users_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qcore-1.2.0 app/controllers/admin/users_controller.rb