Class: NextSgad::EmployeesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NextSgad::EmployeesController
- Defined in:
- app/controllers/next_sgad/employees_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /employees.
-
#destroy ⇒ Object
DELETE /employees/1.
-
#edit ⇒ Object
GET /employees/1/edit.
-
#index ⇒ Object
GET /employees.
-
#new ⇒ Object
GET /employees/new.
-
#show ⇒ Object
GET /employees/1.
-
#update ⇒ Object
PATCH/PUT /employees/1.
Instance Method Details
#create ⇒ Object
POST /employees
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 26 def create @employee = Employee.new(employee_params) if @employee.save redirect_to @employee, notice: 'Employee was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /employees/1
46 47 48 49 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 46 def destroy @employee.destroy redirect_to employees_url, notice: 'Employee was successfully destroyed.' end |
#edit ⇒ Object
GET /employees/1/edit
22 23 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 22 def edit end |
#index ⇒ Object
GET /employees
8 9 10 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 8 def index @employees = Employee.all end |
#new ⇒ Object
GET /employees/new
17 18 19 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 17 def new @employee = Employee.new end |
#show ⇒ Object
GET /employees/1
13 14 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /employees/1
37 38 39 40 41 42 43 |
# File 'app/controllers/next_sgad/employees_controller.rb', line 37 def update if @employee.update(employee_params) redirect_to @employee, notice: 'Employee was successfully updated.' else render :edit end end |