Class: Radmin::UsersController

Inherits:
RadminController show all
Defined in:
app/controllers/radmin/users_controller.rb

Instance Method Summary collapse

Methods inherited from RadminController

#current_ability

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
# File 'app/controllers/radmin/users_controller.rb', line 8

def create
  if @user.save
    redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_created, :default => "Account created."))
  else
    flash.now[:alert] = Radmin::I18n.t(:account_could_not_be_created, :default => "Account could not be created.")
    render :action => :new
  end
end

#destroyObject



27
28
29
30
# File 'app/controllers/radmin/users_controller.rb', line 27

def destroy
  @user.destroy
  redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_deleted, :default => "Account deleted."))
end

#indexObject



4
5
6
# File 'app/controllers/radmin/users_controller.rb', line 4

def index
  @users = @users.includes(:roles)
end

#updateObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/radmin/users_controller.rb', line 17

def update
  if @user.update_attributes(params[:user])
    flash[:notice] = Radmin::I18n.t(:user_updated, :default => "User updated.")
    redirect_to admin_users_url
  else
    flash.now[:alert] = Radmin::I18n.t(:user_could_not_be_updated, :default => "User could not be updated.")
    render :action => :edit
  end
end