Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

ruby on rails - Customize rails_admin to include self-created views and controllers

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...