33

I had a good time playing with Active Admin the administrative framework within my application. http://activeadmin.info/

When I installed it I ran

rails g active_admin:install
rake db:migrate
rails g active_admin:resource product

and it generated alot of migrations and code within my application.

My question if I would like to go back and have everything that active_admin put into my application taken out, how would i do so?

Is there one 'rails active_admin:uninstall' command to get rid of everything or do I have to manually create migrations to delete all the tables and search through my code to see what it added?

1
  • Do you use version control? Commented Jun 23, 2017 at 4:19

3 Answers 3

44

If you run the following code it should destroy active admin:

rails destroy active_admin:install
rails destroy active_admin:resource product
Sign up to request clarification or add additional context in comments.

5 Comments

You don't even need the second line it seems.
Also, keep in mid that if you set up an AdminUser model when you added ActiveAdmin, this will destroy it, along with any methods you added to it.
Beware that some trash code will be left in 'routes.rb' and 'schema.rb'. Do a search for 'admin' and comment the unnecessary code, or it may cause errors later.
do i need to rollback the migration
Also remove gem 'activeadmin' from your gem file or it will install again next time you bundle = ]
29

Run this in terminal

rails destroy active_admin:install

Remove gem 'activeadmin' from your gemfile.

Delete the asset files from js and css folders if any remain

Delete any of these lines in Routes.rb

  devise_for :admin_users, ActiveAdmin::Devise.config
  ActiveAdmin.routes(self)
  ActiveAdmin.routes(self)

Then create a new migration with:

  drop_table :active_admin_comments

You may also need:

  drop_table :admin_notes

Or rollback the migrations by finding the relevant files MoveAdminNotesToComments and CreateAdminNotes in your db/migrate folder

rake db:migrate:down VERSION=the_version_number
rake db:migrate:down VERSION=the_version_number

5 Comments

The new drop migration is much cleaner than the rollback one, but thanks for making this good answer, everything is in here ;)
For everyone ease, I did : rails generate migration drop_active_admin_comments modified the migration like this: `` class DropActiveAdminComments < ActiveRecord::Migration def up drop_table :active_admin_comments end def down raise ActiveRecord::IrreversibleMigration end end `` `` bundle exec rake db:migrate `` the table and indexes are gone ;)
Ok, I just don't know how to format a comment with code in it... so I've finally been rejected the right to reedit my previous comment :/
Oh and don't forget to remove the gem 'active_admin' entry in your Gemfile once the rails destroy active_admin:install is done ;)
Yes. Thank you I have done this now. It works. Destroyed the active_admin and reinstalled the latest version. Rails and Windows 7 dont like eachother much :D
1

You also need to delete all the active admin related js and css files in your assets folder after running rails destroy active_admin:install

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.