Set filter before_action for ActiveAdmin controller
You can access the controller from within the controller do ... end
DSL:
ActiveAdmin.register User do
before_action :set_product, only: [:show, :edit, :update, :destroy]
controller do
def set_product
@product = Product.find_by_name(params[:name])
end
end
end
You can store it in the config: config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
def do_something_awesome
end
config.before_action :do_something_awesome
end