SolidCRUD ๐Ÿš€

Gem Version Rails License

A zero-configuration admin dashboard for Rails 6, 7, and 8. Get a fully functional admin interface in under 30 seconds - no configuration required!

๐Ÿš€ Getting Started

Installation

Add SolidCRUD to your Rails application's Gemfile:

gem 'solidcrud', path: 'path/to/solidcrud'

Then run:

bundle install
rails solidcrud:install

JavaScript & Asset Setup

SolidCRUD includes modern JavaScript, Tailwind CSS, and Sass assets. Install dependencies and build assets:

# Install JavaScript dependencies
npm install

# Build assets for production
npm run build

# Or build and watch for development
npm run build:watch

The build process:

  • JavaScript: Bundles Stimulus controllers and application code with esbuild
  • CSS: Processes Tailwind CSS with PostCSS, includes custom components and utilities

Included Dependencies

  • @hotwired/stimulus (^3.2.2) - For interactive UI components
  • @hotwired/turbo-rails (^8.0.12) - For seamless page updates
  • jquery (^3.7.0) - For legacy compatibility
  • tailwindcss (^3.4.0) - For modern utility-first CSS
  • esbuild (^0.25.0) - For fast JavaScript bundling
  • sass (^1.63.6) - For CSS preprocessing
  • autoprefixer (^10.4.16) - For CSS vendor prefixes
  • postcss (^8.4.32) - For CSS processing

Basic Configuration

Configure SolidCRUD in config/initializers/solidcrud.rb:

Solidcrud.setup do |config|
  # Configure your models
  config.models = ['User', 'Post', 'Comment']

  # Set authentication (see Authentication section below)
  config.authenticate_with do
    # Your authentication logic
  end
end
  • ๐Ÿ”ฅ Zero Configuration: Works out of the box with any Rails app
  • ๐Ÿ“ฑ Responsive Design: Modern Bootstrap 5 UI that works on all devices
  • ๐Ÿ” Smart Search: Automatically searches across text columns
  • ๐Ÿ“Š Sortable Tables: Click any column header to sort
  • ๐Ÿ“„ Pagination: Handles large datasets with elegant pagination
  • ๐ŸŽจ Intelligent Forms: Auto-detects field types (email, phone, date, etc.)
  • ๐Ÿ”’ Model Detection: Automatically discovers all ActiveRecord models
  • โšก Fast Setup: Add gem โ†’ run generator โ†’ visit /admin
  • ๐ŸŽ›๏ธ Configurable: Hide models or customize behavior as needed

๐Ÿš€ Installation & Setup

Prerequisites

Before installing SolidCRUD, ensure you have:

  • Ruby: 2.7 or higher
  • Rails: 6.0 or higher (including Rails 8.x)
  • Database: Any ActiveRecord-supported database (SQLite, PostgreSQL, MySQL, etc.)
  • Node.js & Yarn: For asset compilation (if using Webpacker/Propshaft)

Step 1: Add SolidCRUD to Your Gemfile

Add the gem to your Rails application's Gemfile:

# Gemfile
gem 'solidcrud'

Step 2: Install Dependencies

Run bundle install to install the gem and its dependencies:

bundle install

Step 3: Run the Installation Generator

SolidCRUD includes an installation generator that sets up the necessary configuration:

rails generate solidcrud:install

This generator will:

  • Create config/initializers/solidcrud.rb (optional configuration file)
  • Display setup completion message

Step 4: Mount the Engine Routes

Add the SolidCRUD routes to your config/routes.rb:

# config/routes.rb
Rails.application.routes.draw do
  # ... your existing routes ...

  # Mount SolidCRUD admin interface
  mount Solidcrud::Engine => "/admin"
end

Step 5: Database Setup (if needed)

Ensure your database is set up and migrated:

# Create database (if not exists)
rails db:create

# Run migrations
rails db:migrate

Step 6: Start Your Rails Server

Start your Rails development server:

rails server
# or
rails s

Step 7: Access the Admin Dashboard

Open your browser and navigate to:

http://localhost:3000/admin

You should see the SolidCRUD admin dashboard with all your models listed!

โœ… Verification Steps

After setup, verify everything works:

  1. Dashboard Loads: Visit /admin and see the dashboard
  2. Models Listed: Check that all your ActiveRecord models appear
  3. CRUD Operations: Click on a model and try:
    • Viewing records (should show paginated list)
    • Creating new records (form should load)
    • Editing existing records (if any exist)
    • Searching and sorting functionality

๐Ÿ”ง Troubleshooting

Common Issues

Issue: "uninitialized constant Solidcrud"

  • Solution: Make sure gem 'solidcrud' is in your Gemfile and you've run bundle install

Issue: "No route matches /admin"

  • Solution: Ensure you've added mount Solidcrud::Engine => "/admin" to config/routes.rb

Issue: "Table doesn't exist" errors

  • Solution: Run rails db:migrate to ensure all tables are created

Issue: Models not showing up

  • Solution: Check that your models inherit from ActiveRecord::Base and have database tables
  • Debug: Add puts ActiveRecord::Base.descendants.map(&:name) to see what models Rails finds

Issue: Assets not loading (styling issues)

  • Solution: If using Webpacker, run rails assets:precompile
  • Solution: If using Propshaft, ensure your asset pipeline is configured correctly

Issue: "undefined method" errors in forms

  • Solution: Ensure your model columns exist in the database schema

Getting Help

If you encounter issues:

  1. Check the Rails server logs for error messages
  2. Verify your Rails and Ruby versions meet requirements
  3. Test with a simple model first (like a basic Post or User model)
  4. Check the Issues page for similar problems

Development Mode Tips

For development and testing:

# Run with verbose logging
rails s -v

# Check what models SolidCRUD detects
rails c
> ActiveRecord::Base.descendants.map(&:name)
> Solidcrud.config.models_exclude

๐Ÿ“‹ Requirements

  • Ruby: 2.7+
  • Rails: 6.0+ (tested with Rails 6.x, 7.x, and 8.x)
  • Database: Any ActiveRecord-supported database
  • Dependencies: Automatically handles Bootstrap 5, Font Awesome, and other assets

๏ฟฝ Authentication & Security

SolidCRUD provides flexible authentication options to secure your admin interface. You can now configure authentication types directly at the gem level for cleaner setup.

Quick Authentication Setup

Choose your authentication method by configuring it in your SolidCRUD initializer:

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  # Choose your authentication type
  config.use_basic_auth    # Simple username/password
  # OR
  config.use_devise        # Devise integration
  # OR
  config.use_jwt           # JWT token authentication
  # OR
  config.use_custom        # Custom authentication logic

  # Configure authentication settings
  config.basic_auth_username = 'admin'
  config.basic_auth_password = 'secure_password'
  config.jwt_secret = 'your-jwt-secret'
  config.devise_scope = :admin_user
end

Authentication Types

1. Basic Authentication (use_basic_auth)

Simple HTTP basic authentication - perfect for development or small teams:

Solidcrud.setup do |config|
  config.use_basic_auth
  config.basic_auth_username = 'admin'
  config.basic_auth_password = 'secure_password_here'
end

Pros: Zero dependencies, works everywhere Cons: Basic auth popup, credentials sent on every request

2. Devise Integration (use_devise)

Automatic integration with Devise authentication:

Solidcrud.setup do |config|
  config.use_devise
  config.devise_scope = :admin_user  # or :user for regular users
end

Pros: Secure, feature-rich, zero configuration Cons: Requires Devise gem

3. JWT Authentication (use_jwt)

Token-based authentication for APIs and SPAs:

Solidcrud.setup do |config|
  config.use_jwt
  config.jwt_secret = ENV['JWT_SECRET']
end

Pros: Stateless, scalable, API-friendly Cons: Requires token management

4. Custom Authentication (use_custom)

Full control over authentication logic:

Solidcrud.setup do |config|
  config.use_custom

  config.authenticate_with do
    # Your custom authentication logic here
    authenticate_user!  # Your method
  end
end

Pros: Complete flexibility Cons: Requires implementation

Authentication Methods (Legacy)

1. Basic HTTP Authentication (Simplest)

Perfect for small teams or development environments:

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  config.basic_auth_username = 'admin'
  config.basic_auth_password = 'secure_password_here'
end

Pros: Simple setup, no additional dependencies Cons: Basic auth popup, credentials sent on every request

2. Custom Authentication Method (Most Flexible)

Integrate with your existing authentication system:

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  config.authenticate_with do
    # Check session-based authentication
    if session[:user_id].present?
      return true
    end

    # Check JWT tokens
    if request.headers['Authorization']&.match?(/^Bearer /)
      token = request.headers['Authorization'].sub(/^Bearer /, '')
      # Verify JWT token and set session
      payload = JWT.decode(token, Rails.application.secret_key_base)[0]
      session[:user_id] = payload['user_id']
      return true
    rescue JWT::DecodeError
      return false
    end

    # Redirect to your app's login page
    redirect_to '/login', alert: 'Please login to access admin'
    false
  end
end

Pros: Full control, integrates with existing auth Cons: Requires custom implementation

3. Automatic Devise Integration

If you have Devise installed, SolidCRUD automatically detects and uses it:

# No configuration needed! SolidCRUD detects Devise automatically
# It will call authenticate_user! or authenticate_admin_user!

Pros: Zero configuration, secure by default Cons: Requires Devise gem

4. Multiple Devise Scopes

For applications with different user types:

Solidcrud.setup do |config|
  config.authenticate_with do
    if defined?(Devise)
      authenticate_admin_user!  # For admin scope
      # or authenticate_user!   # For regular users
    end
    true
  end
end

Security Best Practices

Production Security

  1. Always configure authentication in production environments
  2. Use HTTPS to encrypt all admin traffic
  3. Exclude sensitive models from admin interface: ruby config.models_exclude = ['User', 'Payment', 'SecretModel']
  4. Implement authorization using gems like Pundit or CanCanCan
  5. Monitor admin access logs for suspicious activity

Model Exclusion

Always exclude sensitive models in production:

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  config.models_exclude = [
    'User',           # User authentication data
    'AdminUser',      # Admin credentials
    'Payment',        # Payment information
    'CreditCard',     # Financial data
    'AuditLog',       # System logs
    'Session',        # Session storage
    'SecretModel'     # Any sensitive data
  ]
end

Authentication Examples

JWT Integration Example

config.authenticate_with do
  # Check for JWT in Authorization header
  auth_header = request.headers['Authorization']
  if auth_header&.match?(/^Bearer /)
    token = auth_header.sub(/^Bearer /, '')
    begin
      # Decode and verify JWT
      payload = JWT.decode(token, ENV['JWT_SECRET'])[0]

      # Check token expiration
      if payload['exp'] < Time.now.to_i
        redirect_to '/login', alert: 'Token expired'
        return false
      end

      # Check user permissions (admin role required)
      unless payload['role'] == 'admin'
        redirect_to '/unauthorized', alert: 'Admin access required'
        return false
      end

      # Set user context
      session[:user_id] = payload['user_id']
      session[:user_email] = payload['email']

      return true
    rescue JWT::DecodeError => e
      Rails.logger.warn "JWT decode error: #{e.message}"
      return false
    end
  end

  # No valid token found
  redirect_to '/login', alert: 'Authentication required'
  false
end

Session-Based Authentication

config.authenticate_with do
  # Check if user is logged in via session
  if session[:user_id].present?
    # Optional: Check if user still exists and is admin
    user = User.find_by(id: session[:user_id])
    if user&.admin?
      return true
    else
      # User no longer valid, clear session
      session.delete(:user_id)
    end
  end

  # Check for "remember me" token
  if cookies.signed[:remember_token].present?
    user = User.find_by(remember_token: cookies.signed[:remember_token])
    if user&.admin?
      session[:user_id] = user.id
      return true
    end
  end

  # Not authenticated
  redirect_to '/admin/login', alert: 'Please login'
  false
end

API Key Authentication

config.authenticate_with do
  # Check for API key in header
  api_key = request.headers['X-API-Key'] || params[:api_key]

  if api_key.present?
    # Validate API key (implement your own validation logic)
    if valid_api_key?(api_key)
      return true
    else
      render json: { error: 'Invalid API key' }, status: :unauthorized
      return false
    end
  end

  # No API key provided
  render json: { error: 'API key required' }, status: :unauthorized
  false
end

Testing Authentication

Testing Basic Auth

# Test with curl
curl -u admin:password http://localhost:3000/admin

# Test without auth (should fail)
curl http://localhost:3000/admin

Testing JWT Auth

# Test with JWT token
curl -H "Authorization: Bearer your-jwt-token" http://localhost:3000/admin

# Test without token (should redirect)
curl http://localhost:3000/admin

Testing in Rails Console

# Test authentication configuration
Solidcrud.config.authenticate_method
Solidcrud.config.basic_auth_enabled?

# Test user authentication methods
app.get '/admin'  # Should redirect if not authenticated

Troubleshooting Authentication

Common Issues

"Authentication not working"

  • Check that your authenticate_with block returns true/false correctly
  • Verify session/cookies are working
  • Check Rails logs for authentication-related errors

"Infinite redirect loop"

  • Ensure your redirect URL is different from the current path
  • Check that authentication check doesn't redirect to itself

"Devise not detected"

  • Verify Devise gem is installed and required
  • Check that defined?(Devise) returns true

"Session not persisting"

  • Ensure your Rails app has sessions enabled
  • Check session store configuration
  • Verify cookies are being set correctly

Debug Authentication

Add debugging to your authentication block:

config.authenticate_with do
  Rails.logger.info "Auth check: session user_id = #{session[:user_id]}"
  Rails.logger.info "Auth check: headers = #{request.headers['Authorization']}"

  # Your auth logic here...

  Rails.logger.info "Auth result: #{result}"
  result
end

Advanced Security

Rate Limiting

Consider adding rate limiting to prevent brute force attacks:

# Using rack-attack gem
Rack::Attack.throttle('admin_login', limit: 5, period: 60) do |req|
  req.ip if req.path == '/admin/login' && req.post?
end

Audit Logging

Log all admin access for security monitoring:

config.authenticate_with do
  # Your auth logic...

  if authenticated
    Rails.logger.info "Admin access granted: #{current_user.email} from #{request.remote_ip}"
  else
    Rails.logger.warn "Admin access denied from #{request.remote_ip}"
  end

  authenticated
end

Two-Factor Authentication

For high-security environments, consider 2FA:

config.authenticate_with do
  # Primary authentication (username/password)
  # ... your auth logic ...

  # Check 2FA if enabled
  if user.two_factor_enabled?
    unless session[:two_factor_verified]
      redirect_to '/admin/2fa', alert: 'Two-factor authentication required'
      return false
    end
  end

  true
end

Basic CRUD Operations

SolidCRUD automatically provides full CRUD (Create, Read, Update, Delete) operations for all your models:

Viewing Records

  • Dashboard: Visit /admin to see all available models
  • Model List: Click any model name to see paginated records
  • Search: Use the search box to filter records across all text columns
  • Sort: Click column headers to sort (ascending/descending)
  • Pagination: Navigate through pages (25 records per page)

Creating Records

  • Click "New [Model]" button
  • Fill out the intelligent form (fields adapt to column types)
  • Click "Create [Model]" to save
  • Validation errors are displayed inline

Editing Records

  • Click the "Edit" button next to any record
  • Modify fields in the form
  • Click "Update [Model]" to save changes
  • See record creation/update timestamps

Deleting Records

  • Click the "Delete" button next to any record
  • Confirm deletion in the browser dialog
  • Record is permanently removed

Smart Form Fields

SolidCRUD automatically detects the best form field type based on your database columns:

Automatic Field Detection

Column Type Form Field Example
boolean Checkbox active: true
date Date picker birth_date: 1990-01-01
datetime/timestamp Datetime picker created_at: 2024-01-01 12:00:00
text Textarea (4 rows) Long descriptions
integer (foreign key) Select dropdown user_id โ†’ User dropdown
decimal/float Number input price: 29.99

Column Name Intelligence

Column Name Pattern Form Field Example
email Email input with validation user_email
phone/mobile Telephone input phone_number
password Password field (hidden) password_hash
url/link/website URL input with validation website_url
name/title Text input full_name
price/amount/cost Number with currency formatting product_price

Search Functionality

Search works automatically across all text and string columns:

Search Examples:
"[email protected]"  โ†’ Finds users with that email
"Product"          โ†’ Finds any record with "Product" in text fields
"2024"             โ†’ Finds dates containing "2024"
"Active"           โ†’ Finds boolean fields or text containing "Active"

Search Behavior:

  • Searches all string and text columns
  • Case-insensitive matching
  • Partial matches allowed
  • Maintains sort and pagination state

Sorting and Pagination

Sorting

  • Click any column header to sort ascending
  • Click again to sort descending
  • Visual indicator shows current sort direction
  • Works with all column types (strings, numbers, dates)

Pagination

  • Automatically paginates at 25 records per page
  • Shows "X to Y of Z records" counter
  • Previous/Next navigation buttons
  • Direct page number links (for large datasets)

Model Relationships

SolidCRUD handles foreign key relationships intelligently:

Foreign Key Fields

  • Automatically creates dropdown selects
  • Shows related record names (not just IDs)
  • Uses smart display names (name, title, email, etc.)
  • Validates that selected records exist

Display Names for Relations

SolidCRUD picks the best display name by checking these attributes in order:

  1. name
  2. title
  3. label
  4. email
  5. username
  6. Falls back to "ModelName #ID"

Example: A Post belonging to User will show the user's name in dropdowns.

โš™๏ธ Configuration

Basic Configuration

Create config/initializers/solidcrud.rb to customize SolidCRUD behavior:

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  # Hide sensitive models from the admin interface
  config.models_exclude = ['User', 'AdminUser', 'SecretModel']
end

Advanced Configuration Examples

# config/initializers/solidcrud.rb
Solidcrud.setup do |config|
  # Exclude multiple model types
  config.models_exclude = [
    'User',           # User authentication
    'AdminUser',      # Admin users
    'Session',        # Session storage
    'Migration',      # Migration tracking
    'AuditLog',       # Audit trails
    'Payment',        # Sensitive payment data
    'SecretModel'     # Any other sensitive models
  ]

  # You can also exclude by pattern (future feature)
  # config.exclude_pattern = /.*Secret.*/
end

Model Discovery Rules

SolidCRUD automatically includes models that meet ALL of these criteria:

โœ… Included:

  • Inherits from ActiveRecord::Base
  • Is not an abstract class (abstract_class? returns false)
  • Has an existing database table (table_exists? returns true)
  • Is not in the models_exclude list

โŒ Excluded by default:

  • Abstract classes (like ApplicationRecord)
  • Models without database tables
  • Models listed in config.models_exclude
  • Join tables (if following Rails naming conventions)

Configuration File Location

The configuration file should be placed at:

config/initializers/solidcrud.rb

This ensures it loads during Rails initialization. The generator creates this file automatically, but you can create it manually if needed.

๐ŸŽจ Screenshots

Dashboard Overview

Dashboard

Model List View

Model List

Create/Edit Forms

Forms

Deployment & Production

SolidCRUD is production-ready and includes security considerations:

Security Best Practices

  1. Model Exclusion: Always exclude sensitive models in production:

    # config/initializers/solidcrud.rb
    Solidcrud.setup do |config|
     config.models_exclude = ['User', 'AdminUser', 'Payment', 'SecretModel']
    end
    
  2. Authentication: Add authentication to admin routes:

    # config/routes.rb
    authenticate :admin_user do
     mount Solidcrud::Engine => "/admin"
    end
    
  3. Authorization: Consider adding authorization gems like Pundit or CanCanCan

  4. SSL: Always use HTTPS in production

Performance Considerations

  • Pagination: Large datasets are automatically paginated
  • Search: Efficient database queries with proper indexing
  • Assets: Bootstrap and Font Awesome are CDN-loaded by default
  • Caching: Consider fragment caching for frequently accessed admin pages

Monitoring

Monitor these areas in production:

  • Admin access logs
  • Database query performance
  • Memory usage during bulk operations
  • Error rates and user feedback

Asset Pipeline Integration

SolidCRUD works with all Rails asset pipelines:

Propshaft (Rails 8 default)

# config/initializers/assets.rb
Rails.application.config.assets.precompile += %w( solidcrud/application.css )

Webpacker/Shakapacker

Assets are automatically included via the engine.

Sprockets (Rails < 8)

# app/assets/stylesheets/application.css
/*
 *= require solidcrud/application
 */

Customization Examples

Custom Styling

Override SolidCRUD styles in your application:

/* app/assets/stylesheets/admin.css */
.solidcrud-admin .card {
  border-radius: 8px;
}

Custom JavaScript

Add custom admin JavaScript:

// app/assets/javascripts/admin.js
$(document).on('ready', function() {
  // Custom admin functionality
});

๐Ÿ› ๏ธ Development & Testing

Setting Up Development Environment

  1. Clone the repository:

    git clone https://github.com/solidcrud/solidcrud.git
    cd solidcrud
    
  2. Install dependencies:

    bundle install
    
  3. Set up test database:

    cd test/dummy
    bundle install
    rails db:migrate
    cd ../..
    

Running Tests

SolidCRUD uses Minitest for comprehensive testing:

# Run all tests
bundle exec rake test

# Run specific test files
bundle exec ruby -I test test/lib/solidcrud/version_test.rb

# Run with verbose output
bundle exec rake test -v

Test Structure

test/
โ”œโ”€โ”€ lib/solidcrud/          # Unit tests for core functionality
โ”œโ”€โ”€ controllers/solidcrud/  # Controller tests
โ”œโ”€โ”€ integration/            # Integration tests
โ”œโ”€โ”€ dummy/                  # Test Rails application
โ”œโ”€โ”€ test_helper.rb          # Test configuration
โ””โ”€โ”€ README.md               # Testing documentation

Building & Releasing

Building the Gem

# Build the gem
gem build solidcrud.gemspec

# Install locally for testing
gem install solidcrud-0.1.0.gem

Releasing to RubyGems

# Push to RubyGems (requires account and permissions)
gem push solidcrud-0.1.0.gem

Code Quality

SolidCRUD follows Rails best practices:

  • Minitest for comprehensive testing
  • Rails 8 compatible (tested with multiple versions)
  • Semantic versioning for releases

Architecture Overview

lib/
โ”œโ”€โ”€ solidcrud.rb              # Main module
โ”œโ”€โ”€ solidcrud/
โ”‚   โ”œโ”€โ”€ engine.rb            # Rails engine configuration
โ”‚   โ”œโ”€โ”€ configuration.rb     # User configuration
โ”‚   โ””โ”€โ”€ version.rb           # Version information
โ”œโ”€โ”€ generators/              # Rails generators
โ””โ”€โ”€ tasks/                   # Rake tasks (if any)

test/
โ”œโ”€โ”€ lib/solidcrud/           # Unit tests
โ”œโ”€โ”€ controllers/solidcrud/   # Controller tests
โ”œโ”€โ”€ integration/             # Integration tests
โ”œโ”€โ”€ dummy/                   # Test Rails application
โ””โ”€โ”€ test_helper.rb           # Test configuration

app/
โ”œโ”€โ”€ controllers/             # Admin controllers
โ”œโ”€โ”€ helpers/                 # View helpers
โ”œโ”€โ”€ views/                   # Admin interface templates
โ””โ”€โ”€ assets/                  # Stylesheets and assets

๐Ÿ“‹ Requirements & Compatibility

System Requirements

  • Ruby: 2.7 or higher
  • Rails: 6.0 or higher
  • Database: Any ActiveRecord-supported database
  • Web Server: Any Rack-compatible server (Puma, Unicorn, etc.)

Rails Version Compatibility

SolidCRUD is tested and compatible with:

Rails Version Status Notes
Rails 8.x โœ… Fully Supported Latest features and optimizations
Rails 7.x โœ… Fully Supported All features work
Rails 6.x โœ… Fully Supported Core functionality maintained

Database Support

Works with all ActiveRecord-supported databases:

  • SQLite: โœ… (Default for development)
  • PostgreSQL: โœ… (Production recommended)
  • MySQL/MariaDB: โœ…
  • SQL Server: โœ… (Limited testing)
  • Oracle: โœ… (Limited testing)

Browser Support

Modern browsers with JavaScript enabled:

  • Chrome: 90+
  • Firefox: 88+
  • Safari: 14+
  • Edge: 90+

Dependencies

SolidCRUD automatically includes and manages:

  • Bootstrap 5: Responsive UI framework
  • Font Awesome: Icons and visual elements
  • Rails UJS: For form submissions and links
  • jQuery (if configured): For Bootstrap JavaScript components

No additional frontend dependencies required!

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

Development Setup

  1. Fork the repository on GitHub
  2. Clone your fork: bash git clone https://github.com/your-username/solidcrud.git cd solidcrud
  3. Set up development environment: bash bundle install cd test/dummy && bundle install && rails db:migrate && cd ../..
  4. Run tests to ensure everything works: bash bundle exec rake test

Making Changes

  1. Create a feature branch:

    git checkout -b feature/your-feature-name
    # or
    git checkout -b fix/issue-description
    
  2. Make your changes following these guidelines:

    • Add tests for new functionality
    • Update documentation as needed
    • Follow Rails naming conventions
    • Keep the code style consistent
  3. Run tests to ensure nothing breaks:

    bundle exec rake test
    
  4. Update documentation if needed:

    • README.md for user-facing changes
    • Code comments for complex logic
    • CHANGELOG.md for version updates

Pull Request Process

  1. Commit your changes:

    git add .
    git commit -m "Add feature: brief description of changes"
    
  2. Push to your fork:

    git push origin feature/your-feature-name
    
  3. Create a Pull Request on GitHub:

    • Use a clear, descriptive title
    • Provide detailed description of changes
    • Reference any related issues
    • Ensure all tests pass

Types of Contributions

๐Ÿ› Bug Fixes

  • Fix reported issues
  • Add regression tests
  • Update documentation

โœจ New Features

  • Implement new functionality
  • Add comprehensive tests
  • Update README and examples

๐Ÿ“š Documentation

  • Improve setup instructions
  • Add usage examples
  • Fix typos and clarity issues

๐Ÿงช Testing

  • Add missing test coverage
  • Improve test reliability
  • Add integration tests

Code Style Guidelines

  • Follow standard Ruby/Rails conventions
  • Use meaningful variable and method names
  • Add comments for complex logic
  • Keep methods focused and single-purpose
  • Write descriptive test names

Testing Requirements

  • All new code must include tests
  • Tests must pass on all supported Rails versions
  • Maintain or improve code coverage
  • Include both unit and integration tests

Questions?

Feel free to open an issue for questions or discussion before starting work on larger features.

๐Ÿ“ Changelog

See CHANGELOG.md for version history and changes.

๐Ÿ› Bug Reports & Support

Reporting Bugs

Found a bug? Please open an issue with detailed information:

Required Information:

  • Rails version: rails --version
  • Ruby version: ruby --version
  • SolidCRUD version: gem list solidcrud
  • Database: PostgreSQL/MySQL/SQLite version
  • Browser: Chrome/Firefox/Safari version (for UI issues)

Bug Report Template:

## Bug Description
Brief description of the issue

## Steps to Reproduce
1. Step 1
2. Step 2
3. Step 3

## Expected Behavior
What should happen

## Actual Behavior
What actually happens

## Environment
- Rails: X.X.X
- Ruby: X.X.X
- SolidCRUD: X.X.X
- Database: XXX
- Browser: XXX

## Additional Context
Any other relevant information, logs, or screenshots

Common Issues & Solutions

"Model not showing in admin"

  • Check if model inherits from ActiveRecord::Base
  • Verify table exists: rails db:migrate
  • Check if model is excluded in configuration

"Form field not working correctly"

  • Verify column exists in database schema
  • Check column type matches expected behavior
  • Look for validation errors in Rails logs

"Assets not loading"

  • Run rails assets:precompile if using asset pipeline
  • Check browser console for CSS/JS errors
  • Verify Bootstrap/Font Awesome are loading

Getting Help

๐Ÿ’ก Feature Requests

Have ideas for SolidCRUD? We'd love to hear them!

Requesting Features

Open an issue with the "enhancement" label and include:

  • Feature Description: What should the feature do?
  • Use Case: Why is this feature needed?
  • Implementation Ideas: How could this be implemented?
  • Mockups/Screenshots: Visual examples if applicable

Feature Priorities

We're particularly interested in:

  • UI/UX Improvements: Better responsive design, accessibility
  • Performance: Faster loading, better pagination
  • New Field Types: Support for more database column types
  • Customization: More configuration options
  • Integrations: Better support for popular gems

Contributing Features

For larger features, consider:

  1. Opening an issue to discuss the feature first
  2. Breaking down into smaller, manageable PRs
  3. Including comprehensive tests
  4. Updating documentation

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with โค๏ธ for the Rails community
  • Inspired by Django Admin and Rails Admin gems
  • Bootstrap 5 for the beautiful UI
  • Font Awesome for the icons

โญ If SolidCRUD helps you, please star the repository! It helps others discover the project.