How to override the default scope for mongoid with rails_admin?

I currently have default_scope set for my class, but I want rails_admin to execute a request list using .unscoped

Is there any way to do this? I see no way to override the request that rails_admin does.

+4
source share
2 answers

You can name the areas that rails_admin provides for the list action, they will be displayed as tabs in the list action:

list do scopes [:unscoped, :all, :any_other_scope] end 
+1
source

You can use without access :

From mongoid doc:

 Band.unscoped.where(name: "Depeche Mode") Band.unscoped do Band.where(name: "Depeche Mode") end 

Please refer to: Mongoid show

-2
source

Source: https://habr.com/ru/post/1438739/


All Articles