rosa-build/app/controllers/users_controller.rb

41 lines
769 B
Ruby
Raw Normal View History

2011-03-10 11:35:46 +00:00
class UsersController < ApplicationController
2011-03-10 21:48:15 +00:00
def index
@users = User.all
end
def new
@user = User.new
end
def edit
@user = User.find params[:id]
end
def destroy
User.destroy params[:id]
redirect_to users_path
end
def create
@user = User.new params[:user]
if @user.save
flash[:notice] = t('flash.user.saved')
redirect_to users_path
else
flash[:error] = t('flash.user.save_error')
render :action => :new
end
end
def update
@user = User.find params[:id]
if @user.update_attributes(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to users_path
else
flash[:error] = t('flash.user.save_error')
render :action => :edit
end
end
2011-03-10 11:35:46 +00:00
end