Class: Ums::FunctionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ums/functions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /ums/functions POST /ums/functions.json



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/ums/functions_controller.rb', line 26

def create
  @ums_function = Ums::Function.new(ums_function_params)

  respond_to do |format|
    if @ums_function.save
      format.html { redirect_to ums.functions_url, notice: '功能创建创建成功.' }
      format.json { render action: 'show', status: :created, location: @ums_function }
    else
      format.html { render action: 'new' }
      format.json { render json: @ums_function.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /ums/functions/1 DELETE /ums/functions/1.json



56
57
58
59
60
61
62
# File 'app/controllers/ums/functions_controller.rb', line 56

def destroy
  @ums_function.destroy
  respond_to do |format|
    format.html { redirect_to ums.functions_url , notice: '功能删除成功.'}
    format.json { head :no_content }
  end
end

#editObject

GET /ums/functions/1/edit



21
22
# File 'app/controllers/ums/functions_controller.rb', line 21

def edit
end

#indexObject

GET /ums/functions GET /ums/functions.json



6
7
8
# File 'app/controllers/ums/functions_controller.rb', line 6

def index
  @ums_functions = Ums::Function.all
end

#newObject

GET /ums/functions/new



16
17
18
# File 'app/controllers/ums/functions_controller.rb', line 16

def new
  @ums_function = Ums::Function.new
end

#showObject

GET /ums/functions/1 GET /ums/functions/1.json



12
13
# File 'app/controllers/ums/functions_controller.rb', line 12

def show
end

#updateObject

PATCH/PUT /ums/functions/1 PATCH/PUT /ums/functions/1.json



42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/ums/functions_controller.rb', line 42

def update
  respond_to do |format|
    if @ums_function.update(ums_function_params)
      format.html { redirect_to ums.functions_url, notice: '功能修改成功' }
      format.json { head :no_content }
    else
      format.html { render action: 'edit' }
      format.json { render json: @ums_function.errors, status: :unprocessable_entity }
    end
  end
end