I'm migrating an existing app to Rails 5 and using Devise for authentication. Database is Oracle12c.
I'm trying to figure out how to execute the following sql on the rails connection whenever a user would query the database. This context is required for the schema triggers to function correctly and this context should reflect the username of the user that is executing the query.
begin
main.ENV_VAR.prc_set_context_value('UserContext', '#{current_user}');
end;
Is there some sort of ActiveRecord hook to use to whenever a user is querying? Is there a Devise hook to use? Do I override ActiveRecord::Base?
Thanks for any assistance.