What do you do when you create a management screen in Rails? If you want to make it properly, I think it's better to make it yourself, but you can't devote that much man-hours to personal development! For that time I would like to introduce the management screen generation gem Administrate.
Rails library that automatically generates management screens. It provides non-technical users with a clean interface that allows them to create, edit, search, and delete any record in their application. (From official)
I don't think you can tell by looking at the text, so it's quick to touch the Official Demo.
Official site (English): https://administrate-prototype.herokuapp.com/ Official demo: https://administrate-prototype.herokuapp.com/admin Official Github (thoughtbot/administrate): https://github.com/thoughtbot/administrate
Since it is version 1.0 or earlier, the API may undergo major changes. It seems better to check the Release Notes before updating.
Administrate is still pre-1.0, and there may be occasional breaking changes to the API.
Added to Gemfile
# Gemfile
gem "administrate"
After bundle install, run the installer
#Install with default settings(Default namespace: admin)
$ rails generate administrate:install
#When you want to use any namespace(namespace: supervisor)
$ rails generate administrate:install --namespace=supervisor
The routes for / admin
are added to config/routes.rb
and app/controllers/admin/application_controller.rb
is generated.
It also generates a Dashboard and Controller for each ActiveRecord resource.
# --namespace=For supervisor
http://localhost:3000/supervisor
app/controllers/supervisor/application_controller.rb
This completes the installation and you can use all the functions (create, edit, search, delete). Administrate can be customized in various ways to make it easier to use, so I would like to introduce some of them next time.
Recommended Posts