Hello there,
I'm Adrian, the author of Avo, and I'm excited to share a neat trick with you today. In this tutorial, I'll be demonstrating how to attach hooks and business logic to Avo's controllers using a Current
model.
You may already be familiar with Rails' Current
model, which is used to set the current user, multi-tenancy accounts, or other pieces of information. Typically, before_action
is used in your ApplicationController
to demonstrate how Current
works. However, if you attempt to apply the same changes to your app the action will not work in Avo's context. This is because Avo has its own AplicationController
.
So how do we apply this behavior inside Avo? Let me walk you through it.
Firstly, we configure the Current
model and create the concern that holds the business logic.