Class: Banal::EmployeesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/banal/employees_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#choose_layout

Instance Method Details

#createObject

POST /banal/employees POST /banal/employees.json



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

def create
  @banal_employee = Banal::Employee.new(banal_employee_params)

  respond_to do |format|
    if @banal_employee.save
      format.html { redirect_to @banal_employee, notice: 'Employee was successfully created.' }
      format.json { render :show, status: :created, location: @banal_employee }
    else
      format.html { render :new }
      format.json { render json: @banal_employee.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /banal/employees/1 DELETE /banal/employees/1.json



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

def destroy
  @banal_employee.destroy
  respond_to do |format|
    format.html { redirect_to banal_employees_url, notice: 'Employee was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /banal/employees/1/edit



21
22
# File 'app/controllers/banal/employees_controller.rb', line 21

def edit
end

#indexObject

GET /banal/employees GET /banal/employees.json



6
7
8
# File 'app/controllers/banal/employees_controller.rb', line 6

def index
  @banal_employees = Banal::Employee.all
end

#newObject

GET /banal/employees/new



16
17
18
# File 'app/controllers/banal/employees_controller.rb', line 16

def new
  @banal_employee = Banal::Employee.new
end

#showObject

GET /banal/employees/1 GET /banal/employees/1.json



12
13
# File 'app/controllers/banal/employees_controller.rb', line 12

def show
end

#updateObject

PATCH/PUT /banal/employees/1 PATCH/PUT /banal/employees/1.json



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

def update
  respond_to do |format|
    if @banal_employee.update(banal_employee_params)
      format.html { redirect_to @banal_employee, notice: 'Employee was successfully updated.' }
      format.json { render :show, status: :ok, location: @banal_employee }
    else
      format.html { render :edit }
      format.json { render json: @banal_employee.errors, status: :unprocessable_entity }
    end
  end
end