Class: HrLite::Admin::OfficeLocationsController
- Inherits:
-
LeadershipController
- Object
- HrLite::ApplicationController
- BaseController
- LeadershipController
- HrLite::Admin::OfficeLocationsController
- Defined in:
- app/controllers/hr_lite/admin/office_locations_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 12 def create @office_location = OfficeLocation.new(office_location_params) if @office_location.save redirect_to admin_office_locations_path, notice: "Office added." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
34 35 36 37 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 34 def destroy OfficeLocation.find(params[:id]).destroy! redirect_to admin_office_locations_path, notice: "Office removed.", status: :see_other end |
#edit ⇒ Object
21 22 23 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 21 def edit @office_location = OfficeLocation.find(params[:id]) end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 4 def index @office_locations = OfficeLocation.order(:name) end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 8 def new @office_location = OfficeLocation.new end |
#update ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/hr_lite/admin/office_locations_controller.rb', line 25 def update @office_location = OfficeLocation.find(params[:id]) if @office_location.update(office_location_params) redirect_to admin_office_locations_path, notice: "Office updated." else render :edit, status: :unprocessable_entity end end |