Class: Dashboard::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/blacksand/dashboard/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /users POST /users.json



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 29

def create
  @user = User.new(user_params)

  respond_to do |format|
    if @user.save
      format.html { redirect_to dashboard_users_url, notice: t('user.user_save_success_notice') }
      format.json { render :show, status: :created, location: @user }
    else
      format.html { render :new }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /users/1 DELETE /users/1.json



59
60
61
62
63
64
65
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 59

def destroy
  @user.destroy
  respond_to do |format|
    format.html { redirect_to dashboard_users_url, notice: t('user.user_delete_success_notice') }
    format.json { head :no_content }
  end
end

#editObject

GET /users/1/edit



24
25
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 24

def edit
end

#indexObject

GET /users GET /users.json



9
10
11
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 9

def index
  @users = User.normal
end

#newObject

GET /users/new



19
20
21
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 19

def new
  @user = User.new
end

#showObject

GET /users/1 GET /users/1.json



15
16
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 15

def show
end

#updateObject

PATCH/PUT /users/1 PATCH/PUT /users/1.json



45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/blacksand/dashboard/users_controller.rb', line 45

def update
  respond_to do |format|
    if @user.update(user_params)
      format.html { redirect_to dashboard_users_url, notice: t('user.user_edit_success_notice') }
      format.json { render :show, status: :ok, location: @user }
    else
      format.html { render :edit }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end