Class: Monologue::Admin::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/monologue/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/monologue/admin/users_controller.rb', line 30

def create
  @user = Monologue::User.new user_params
  if @user.save
    flash.notice = I18n.t("monologue.admin.users.create.success")
    redirect_to admin_users_path
  else
    render :new
  end
end

#destroyObject



22
23
24
25
26
27
28
# File 'app/controllers/monologue/admin/users_controller.rb', line 22

def destroy
  if @user.destroy
    redirect_to admin_users_path, notice:  I18n.t("monologue.admin.users.delete.removed", user: @user.name)
  else
    redirect_to admin_users_path, alert: I18n.t("monologue.admin.users.delete.failed", user: @user.name)
 end
end

#editObject



5
6
7
# File 'app/controllers/monologue/admin/users_controller.rb', line 5

def edit

end

#indexObject



40
41
42
# File 'app/controllers/monologue/admin/users_controller.rb', line 40

def index
  @users = Monologue::User.all
end

#newObject



9
10
11
# File 'app/controllers/monologue/admin/users_controller.rb', line 9

def new
  @user = Monologue::User.new
end

#updateObject



13
14
15
16
17
18
19
20
# File 'app/controllers/monologue/admin/users_controller.rb', line 13

def update
  if @user.update user_params
    flash.notice = "User modified"
    redirect_to admin_users_path
  else
    render :edit
  end
end