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