First, I tried to add a file in config/initializers containing:
RailsAdmin::MainController.class_eval do
def get_sort_hash
CODE HERE…
end
end
It was only loaded once, and then the method from the gem was always
executed instead of mine.
I also tried to add the code in lib/ with the correct line in
config/application.rb to load all files in lib/. But in this case it
does
not work at all.
Each time I defined my method using the following blocks:
RailsAdmin::MainController.class_eval do end
::RailsAdmin::MainController.class_eval do end
I want to be able to sort a view of a model that has nested belongs to:
Checkin belongs to a Program that belongs to a User
So I want to sort the checkins according to the linked users.