Administrate

https://github.com/thoughtbot/administrate#getting-started

Administrate is a library for Rails apps that automatically generates admin dashboards. Administrate's admin dashboards give non-technical users clean interfaces that allow them to create, edit, search, and delete records for any model in the application.
admin 52 1

Fork

drbragg
drbragg

May 18, 2020

Copy and paste this code into your terminal

DISCLAIMER: You should always review templates before running them. By running the template, you are agreeing to the terms of use.

The contents of this script as show. Any updates will be reflected in the below code and the snippet.

gem 'administrate'

run 'bundle install'
run 'DISABLE_SPRING=true rails g administrate:install'
helper = <<-RUBY # Expose our application's helpers to Administrate config.to_prepare do Administrate::ApplicationController.helper #{Rails.application.class.module_parent_name.camelize}::Application.helpers end RUBY
environment helper + "\n" append_to_file "app/assets/config/manifest.js", "//= link administrate/application.css\n//= link administrate/application.js"
gsub_file 'app/controllers/admin/application_controller.rb', /# TODO Add authentication logic here\./, "redirect_to '/', alert: 'Not authorized.' unless user_signed_in? && current_user.admin?"

A place where you can thank the author, post problems, give constructive feedback, etc. Be nice!

  • moktardev
    dude add the ``` to your codeĀ 
    by moktardev at 7:02PM, 21 May 2020
  • Dave Kimura
    I've added a forced <pre> for any source codes which do not include it. This should help a bit, but in most cases, it is always ideal to sue the <> button to place your code in. This will pick up on the syntax highlighting and display it properly.
    by Dave Kimura at 8:16PM, 21 May 2020
  • drbragg
    Sorry about that... fixed
    by drbragg at 4:07PM, 23 May 2020