Is there a way to customize rails_admin search. I need search to be performed from Read Replica DB, rest operations will be performed from write DB only.
Asked
Active
Viewed 119 times
1
-
You need to switch the database only for rails admin controller, you can do it in the ApplicationController because the rails admin controllers inherit from it. Using this guide https://guides.rubyonrails.org/active_record_multiple_databases.html – Guillermo Siliceo Trueba Mar 17 '20 at 15:48
-
@GuillermoSiliceoTrueba, I need to switch database connection only for Rails Admin search functionality and not for listing, new, edit, delete actions. – Vikash Agarwal Mar 18 '20 at 14:55
-
You cannot separate listing from the search action. RailsAdmin use the same code to do both, you'd have to write your own list action, which is a ton of work and upgrading the gem would be super painful. An option that provides rails is to have reads from one database and writes from another https://prathamesh.tech/2019/08/13/rails-6-multi-database-part-two/ – Guillermo Siliceo Trueba Mar 18 '20 at 15:22