Is there a method to do something in the Application Controller when any new record is created in all models/controllers of the application?
CodePudding user response:
You can do something like this if you want a method before all controllers :
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
before_action :my_method
protected
def my_method
# do stuff
end
end
Note that you have all these available : https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html