Rails_admin nautical hide model not working

I have one model that I want to hide from navigation to the left of rails_admin, but it does not work. (I still want to access it, I just want to hide it from the panel, so it’s not worth excluding it)

I tried all three kinds of code below, but it does not work:

config.model 'Document' do visible false end 

from here: https://github.com/sferik/rails_admin/wiki/Navigation

As well as the code:

 config.model 'Document' do hide_from_navigation end 

from here: http://www.verious.com/code/foca/rails_admin/

As well as the code:

 config.model 'Document' do navigation do visible = false end end 

Can someone explain to me why?

I already rebooted the server before checking it out.

Thanks!

+7
source share
4 answers

in the file app / config / initializers / rails_admin.rb you can add something like this and include only the models that you want to display in your navigation -

 config.included_models = [ User, Region, Newsletter, Article ] 
+2
source

I just checked the first example:

 config.model 'Document' do visible false end 

and it worked, the model was hidden.

Be sure to remember that you need to restart the rails.

+1
source

I had the same problem and unfortunately I did not find a suitable solution. The only workaround was to hack the Rails Admin using javascript.

So, to hide the model document from the navigation menu, I added this code to "app / assets / javascripts / rails_admin / custom / ui.js":

 $(document).on('rails_admin.dom_ready', function() { $('ul.nav-pills li[data-model="document"]').hide(); }); 

I hope that the best way to do this will be implemented soon.

+1
source

I decided to add the following line of code to config / initializers / rails_admin.rb:

 config.excluded_models= [Document] 

Instead:

 config.excluded_models = ['Document'] 
0
source

All Articles