Introduction and introduction of management screen generation gem Administrate

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.

What is 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

※Note

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.

image.png

Introduction

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.

* When namespace is specified, the root and directory name will change.

# --namespace=For supervisor
http://localhost:3000/supervisor
app/controllers/supervisor/application_controller.rb

At the end

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

Introduction and introduction of management screen generation gem Administrate
Introduction and precautions of gem Friendly Id
Introduction and basic usage of Simple Calendar gem
[No.006] Rough design of organization management screen and login
Introduction of Docker Hub and commands Self-learning ①
Introduction and usage explanation of Font Awesome
Introduction of New Generation Java Programming Guide (Java 11)
Introduction of New Generation Java Programming Guide (Java 12)
JAVA: Realizes generation and scanning of various barcodes
Introduction of Rspec and Japanese localization of error messages
Introduction of milkode
Ruby and Gem
[No.007] Organization management screen and login process to the organization
[Practice! ] Introduction of JFrame (explaining up to screen creation)