Convert Figma logo to code with AI

thoughtbot logoadministrate

A Rails engine that helps you put together a super-flexible admin dashboard.

5,873
1,113
5,873
120

Top Related Projects

The administration framework for Ruby on Rails applications.

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data

ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine

Quick Overview

Administrate is a Rails engine that helps you build a flexible, customizable admin dashboard for your Ruby on Rails applications. It automatically generates admin pages for your models, providing a clean and intuitive interface for managing your application's data.

Pros

  • Easy to set up and integrate with existing Rails applications
  • Highly customizable, allowing you to tailor the dashboard to your specific needs
  • Follows Rails conventions, making it familiar for Rails developers
  • Responsive design, suitable for both desktop and mobile devices

Cons

  • Limited out-of-the-box features compared to some other admin panel solutions
  • May require additional customization for complex data relationships
  • Performance can be an issue with large datasets
  • Documentation could be more comprehensive for advanced use cases

Code Examples

  1. Generating an admin dashboard for a model:
rails generate administrate:dashboard User

This command generates a dashboard for the User model, creating necessary controllers and views.

  1. Customizing a field in the dashboard:
class UserDashboard < Administrate::BaseDashboard
  ATTRIBUTE_TYPES = {
    email: Field::Email,
    name: Field::String,
    created_at: Field::DateTime,
    updated_at: Field::DateTime,
  }
  # ...
end

This code customizes the field types for the User dashboard, specifying an Email field for the email attribute.

  1. Adding a custom action to a dashboard:
class UserController < Administrate::ApplicationController
  def activate
    requested_resource.activate!
    redirect_to(
      [namespace, requested_resource],
      notice: "#{requested_resource.name} has been activated."
    )
  end
end

This example adds a custom 'activate' action to the UserController, allowing admins to activate users from the dashboard.

Getting Started

  1. Add Administrate to your Gemfile:

    gem "administrate"
    
  2. Install the gem:

    bundle install
    
  3. Generate dashboards for your models:

    rails generate administrate:install
    
  4. Start your Rails server and visit /admin to see your new admin dashboard.

Competitor Comparisons

The administration framework for Ruby on Rails applications.

Pros of Active Admin

  • More mature and feature-rich, with a larger ecosystem of plugins and extensions
  • Offers a DSL for quickly defining admin interfaces with minimal code
  • Provides a complete admin dashboard out of the box, including authentication

Cons of Active Admin

  • Can be more challenging to customize and extend beyond basic use cases
  • Heavier and potentially slower for large applications due to its comprehensive feature set
  • Less flexible in terms of UI customization compared to Administrate

Code Comparison

Active Admin:

ActiveAdmin.register Post do
  permit_params :title, :body, :published_at

  index do
    selectable_column
    column :title
    column :published_at
    actions
  end
end

Administrate:

class PostDashboard < Administrate::BaseDashboard
  ATTRIBUTE_TYPES = {
    id: Field::Number,
    title: Field::String,
    body: Field::Text,
    published_at: Field::DateTime,
  }

  COLLECTION_ATTRIBUTES = [:id, :title, :published_at]
  SHOW_PAGE_ATTRIBUTES = [:id, :title, :body, :published_at]
  FORM_ATTRIBUTES = [:title, :body, :published_at]
end

Both Active Admin and Administrate are popular Ruby on Rails admin panel generators. Active Admin offers a more comprehensive solution with its DSL and built-in features, while Administrate provides a lighter, more customizable approach using plain Ruby classes.

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data

Pros of Rails Admin

  • More mature and feature-rich, with a larger community and ecosystem
  • Offers a wider range of customization options out-of-the-box
  • Includes built-in support for various ORMs (Active Record, Mongoid, etc.)

Cons of Rails Admin

  • Can be more complex to set up and configure for specific use cases
  • May have a steeper learning curve for beginners
  • Performance can be slower for large datasets due to its comprehensive feature set

Code Comparison

Rails Admin configuration:

RailsAdmin.config do |config|
  config.authenticate_with do
    warden.authenticate! scope: :user
  end
  config.current_user_method(&:current_user)
end

Administrate configuration:

Rails.application.routes.draw do
  namespace :admin do
    resources :users
    root to: "users#index"
  end
end

Both Rails Admin and Administrate are popular admin panel solutions for Ruby on Rails applications. Rails Admin offers more features and flexibility, making it suitable for complex projects, while Administrate focuses on simplicity and ease of use, making it a good choice for smaller projects or those requiring a clean, customizable interface.

ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine

Pros of Comfortable Mexican Sofa

  • More flexible content management with a focus on CMS functionality
  • Built-in support for multiple languages and localization
  • Includes a WYSIWYG editor for easier content creation

Cons of Comfortable Mexican Sofa

  • Steeper learning curve due to more complex features
  • Less suitable for general-purpose admin interfaces
  • May require more customization for non-CMS use cases

Code Comparison

Comfortable Mexican Sofa (route definition):

comfy_route :cms_admin, path: "/admin"
comfy_route :cms, path: "/"

Administrate (dashboard definition):

class ProductDashboard < Administrate::BaseDashboard
  ATTRIBUTE_TYPES = {
    id: Field::Number,
    name: Field::String,
    price: Field::Number
  }
end

Both repositories offer admin panel solutions for Ruby on Rails applications, but they cater to different needs. Comfortable Mexican Sofa is more focused on content management systems, providing features like page templates and content blocks. Administrate, on the other hand, is a more general-purpose admin interface generator that can be easily customized for various data models.

While Comfortable Mexican Sofa offers more out-of-the-box CMS functionality, Administrate provides a simpler and more straightforward approach to creating admin panels for diverse data types. The choice between the two depends on the specific requirements of your project and whether you need a full-fledged CMS or a more flexible admin interface.

Pros of Inherited Resources

  • Lightweight and focused on simplifying RESTful controllers
  • Seamless integration with ActiveAdmin for rapid admin interface development
  • Highly customizable through inheritance and overrides

Cons of Inherited Resources

  • Less feature-rich compared to Administrate's comprehensive admin panel solution
  • Requires more manual setup for complex admin interfaces
  • Limited built-in UI components and styling options

Code Comparison

Inherited Resources:

class ProductsController < InheritedResources::Base
  actions :all, except: [:destroy]
end

Administrate:

class ProductDashboard < Administrate::BaseDashboard
  ATTRIBUTE_TYPES = {
    id: Field::Number,
    name: Field::String,
    price: Field::Number.with_options(prefix: "$", decimals: 2)
  }
end

Summary

Inherited Resources is a lightweight solution for simplifying RESTful controllers, particularly useful when integrated with ActiveAdmin. It offers flexibility through inheritance but requires more manual setup for complex admin interfaces.

Administrate, on the other hand, provides a more comprehensive admin panel solution with built-in UI components and styling options. It offers a more structured approach to creating admin interfaces but may have a steeper learning curve for simpler use cases.

The choice between the two depends on the project's specific requirements, complexity, and desired level of customization for the admin interface.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Administrate

CircleCI Gem Version Code Climate Reviewed by Hound

A framework for creating flexible, powerful admin dashboards in Rails. Try the demo.

Warning:

Administrate is still pre-1.0, and there may be occasional breaking changes to the API. Check the release notes for important updates.

administrate

What Is Administrate?

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.

Administrate solves the same problem as Rails Admin and ActiveAdmin, but aims to provide a better user experience for site admins, and to be easier for developers to customize.

To accomplish these goals, Administrate follows a few guiding principles:

  • No DSLs (domain-specific languages)
  • Support the simplest use cases, and let the user override defaults with standard tools such as plain Rails controllers and views.
  • Break up the library into core components and plugins, so each component stays small and easy to maintain.

Documentation

To customize the appearance, behavior, and contents of the dashboard, we publish a set of guides for the current release.

These guides are available as markdown files in the docs subdirectory of the git repository, too.

We publish docs for the upcoming release, which you can find at our prerelease app.

Contributing

Please see CONTRIBUTING.md.

Administrate was originally written by Grace Youngblood and is now maintained by Nick Charlton. Many improvements and bugfixes were contributed by the open source community.

License

administrate is Copyright © 2015 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects. We are available for hire.