Class: ActiveadminSettings::AdminUsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/activeadmin_settings/admin_users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
# File 'app/controllers/activeadmin_settings/admin_users_controller.rb', line 13

def create
  @object = AdminUser.new(params[:admin_user])
  if @object.save
    render :partial => "admin/settings/admin", :locals => {:admin => @object}, :layout => false
  else
    render :text => @object.errors.to_json, :status => :unprocessable_entity
  end
end

#destroyObject



22
23
24
25
26
# File 'app/controllers/activeadmin_settings/admin_users_controller.rb', line 22

def destroy
  @object = AdminUser.find(params[:id])
  @object.destroy
  redirect_to "/admin/settings#admins"
end

#updateObject



4
5
6
7
8
9
10
11
# File 'app/controllers/activeadmin_settings/admin_users_controller.rb', line 4

def update
  @object = AdminUser.find(params[:id])
  if @object.update_attributes(params[:admin_user])
    render :text => "ok"
  else
    render :text => @object.errors.to_json, :status => :unprocessable_entity
  end
end