Class: EducodeSales::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- EducodeSales::ApplicationController
show all
- Defined in:
- app/controllers/educode_sales/application_controller.rb
Direct Known Subclasses
ActivitiesController, AssessmentsController, BusinessesController, CommonsController, CustomerExtensionsController, CustomerFollowsController, CustomersController, FollowUpsController, HomeController, ImportTeachersController, KeyPersonController, MoneyPlansController, OperationPlansController, OperationReportsController, OperationsController, PlacesController, PlansController, RecyclesController, ResultsController, RolesController, SaleReportsController, SaleTrendsController, SalesController, SessionsController, StaffsController, TeacherFollowsController, TeachersController, UploadFilesController
Instance Method Summary
collapse
Instance Method Details
#authenticate_admin ⇒ Object
24
25
26
27
28
|
# File 'app/controllers/educode_sales/application_controller.rb', line 24
def authenticate_admin
unless current_user&.is_admin
redirect_to no_permission_path
end
end
|
#authenticate_request ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/educode_sales/application_controller.rb', line 18
def authenticate_request
unless current_user
redirect_to login_path
end
end
|
#current_user ⇒ Object
14
15
16
|
# File 'app/controllers/educode_sales/application_controller.rb', line 14
def current_user
@current_admin ||= Staff.find_by_id(session[:admin_id])
end
|
#render_failure(msg) ⇒ Object
10
11
12
|
# File 'app/controllers/educode_sales/application_controller.rb', line 10
def render_failure(msg)
render json: { success: false, msg: msg.is_a?(String) ? msg : msg.errors.full_messages.join(",") }, status: 403
end
|
#render_success ⇒ Object
6
7
8
|
# File 'app/controllers/educode_sales/application_controller.rb', line 6
def render_success
render json: { success: true }
end
|