Class: Cats::Core::ApplicationController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Cats::Core::ApplicationController
- Defined in:
- app/controllers/cats/core/application_controller.rb
Direct Known Subclasses
AccessController, CashDonationsController, CommoditiesController, CommodityCategoriesController, CommodityDonationsController, CurrenciesController, DispatchAuthorizationsController, DispatchPlanItemsController, DispatchPlansController, DispatchTransactionsController, DispatchesController, InventoryAdjustmentsController, LoansController, LocationsController, LostCommoditiesController, MenusController, NotificationsController, PurchaseOrdersController, ReceiptAuthorizationsController, ReceiptTransactionsController, ReceiptsController, RolesController, RoundBeneficiariesController, RoundPlansController, RoutesController, SpacesController, StackTransactionsController, StacksController, StoresController, SwapsController, TransportersController, UnitConversionsController, UnitOfMeasuresController, UsersController
Instance Method Summary collapse
- #authenticate ⇒ Object
- #current_user ⇒ Object
-
#skip_bullet ⇒ Object
In case we want to disable bullet for specific controller actions.
Instance Method Details
#authenticate ⇒ Object
13 14 15 |
# File 'app/controllers/cats/core/application_controller.rb', line 13 def authenticate render json: {error: "Unauthorized"}, status: 401 if current_user.nil? end |
#current_user ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/cats/core/application_controller.rb', line 6 def current_user return if token.nil? user = User.find(auth["id"]) @current_user ||= user end |
#skip_bullet ⇒ Object
In case we want to disable bullet for specific controller actions
18 19 20 21 22 23 24 |
# File 'app/controllers/cats/core/application_controller.rb', line 18 def skip_bullet previous_value = Bullet.enable? Bullet.enable = false yield ensure Bullet.enable = previous_value end |