Sha256: 3a0935ba72bc07e11cfc63ab52ceb2797454d73dbc1ed72d260f64eaef0bd34b

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

class Admin::UsersController < AdminController
  
  before_filter :get_user, :except => [:new, :create, :index]
  
  def index
    @users = User.all
  end

  def new
    @user = User.new
  end
  
  def create
    @user = User.new(params[:user])
    if @user.save
      flash[:notice] = "User was successfully created!"
      redirect_back_or_default admin_users_url
    else
      render :action => :new
    end
  end
  
  def show
  end

  def edit
  end
  
  def update
    if @user.update_attributes(params[:user])
      flash[:notice] = "Account updated!"
      redirect_to admin_users_url
    else
      render :action => :edit
    end
  end
  
  protected 
  
  def get_user
    @user = User.find(params[:id])
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
handy-generators-0.0.2 rails_generators/handy_setup/templates/admin_users_controller.rb
handy-generators-0.0.1 rails_generators/handy_setup/templates/admin_users_controller.rb
handy-generators-0.0.0 rails_generators/handy_setup/templates/admin_users_controller.rb