An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
Adding ActiveAdmin to a Rails 7 Application.
To add the ActiveAdmin gem to a Rails 7 application, follow these steps:
Add the ActiveAdmin gem to your Gemfile and run bundle install to install it.
gem 'activeadmin', github: 'activeadmin'
Run the ActiveAdmin installer to create the necessary configuration files and directories.
rails generate active_admin:install
Run the migrations to create the ActiveAdmin database tables.
rails db:migrate
Restart your Rails server to pick up the changes.
Now that ActiveAdmin is installed, you can create resources to manage your data. To do this, run the following command, replacing Product with the name of your model:
rails generate active_admin:resource Product
This will create a new file at app/admin/product.rb, which defines the ActiveAdmin resource for the Product model. You can edit this file to customize the way the resource is displayed and managed in the ActiveAdmin dashboard.
To access the ActiveAdmin dashboard, navigate to http://localhost:3000/admin in your web browser. You should see the login page, where you can enter the default username ([email protected]) and password (password) to log in.
Once you're logged in, you can click on the Products link in the menu to view and manage the Product resource. You can use the various controls on the page to create, edit, and delete records, as well as search and filter the data.
That's it! You should now have a working ActiveAdmin installation for your Rails 7 application. You can continue to customize the configuration and add more resources as needed to manage your data.
Original Link: https://dev.to/meritonaliu/adding-activeadmin-to-a-rails-7-application-1ipe
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To