Customize rails_admin to include self-created views and controllers
Asked Answered
M

1

5

I started using rails_admin engine lately and can't quite figure out how I can add my own pages to it. My requirement exactly is that I have a controller and view that fetches all the available mongoDb collections and displays at

http://localhost:3000/mongo/collections

Is it possible to merge this view somehow with rails admin so that I get a link as

http://localhost:3000/admin/mongo

I am not using ActiveRecords or models. I'm fetching the data from HTTP request and displaying it. Ideally, I need a tab for my page just below the default dashboard tab. Thanks in advance.

Morbilli answered 13/1, 2012 at 3:21 Comment(1)
Were you able to solve it? I tried the answer and got stuck.Siccative
A
7

If you want to display this as a tab, take a look at RailsAdmin's new custom actions.

I just gave some examples and links in my answer to this question.


If you don't want to add this functionality as a custom action, you can:

  • Map a route to your controller & action
  • Have your controller inherit from RailsAdmin MainController and write code for your action
  • Include a view for your action
  • Copy a RailsAdmin view over to add it in as a tab

However, I'd recommend the custom action approach because it does not require you to keep your copied RailsAdmin view updated.

Attenuation answered 10/2, 2012 at 5:6 Comment(1)
I have issue on step 2. The controller requires a model (in the to_model_name method). How do I make it work without model?Siccative

© 2022 - 2024 — McMap. All rights reserved.