Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 2.81 KB

File metadata and controls

91 lines (66 loc) · 2.81 KB

Beautiful Formatting

Automatic colored and styled output for ActiveRecord objects, relations, and collections.

Automatic Formatting

The gem automatically formats ActiveRecord objects when displayed in the console:

# ActiveRecord objects
user = User.first
# Automatically displayed with colors and formatting

# Relations
User.where(active: true)
# Automatically formatted with pagination

# Collections
User.limit(10).to_a
# Automatically formatted with nice layout

Example Output

┌─────────────────────────────────────────────────────────┐
│ User #1                                                  │
├─────────────────────────────────────────────────────────┤
│ id:         1                                            │
│ email:      john@example.com                             │
│ name:       John Doe                                     │
│ active:     true                                         │
│ created_at: 2024-01-01 12:00:00 UTC                     │
│ updated_at: 2024-01-02 10:30:00 UTC                     │
└─────────────────────────────────────────────────────────┘

Pagination

Large collections are automatically paginated:

# Collection with more than 10 items
User.all
# Shows: "Showing 1-10 of 1234 records. Press Enter for more..."

# Relations are paginated automatically
Post.where(published: true)
# Shows paginated results

Configuration

Customize formatting in your initializer:

RailsConsolePro.configure do |config|
  # Color scheme
  config.color_scheme = :dark  # or :light
  
  # Pagination settings
  config.pagination_enabled = true
  config.pagination_threshold = 10
  config.pagination_page_size = 5
  
  # Custom colors
  config.set_color(:header, :bright_blue)
  config.set_color(:key, :cyan)
  config.set_color(:value, :white)
end

Formatted Objects

  • ActiveRecord objects: Single records with all attributes
  • ActiveRecord relations: Paginated collections
  • Arrays: Formatted lists
  • Command results: Schema, stats, explain, diff results

Features

  • Color Coding: Different colors for different data types
  • Automatic Pagination: Large collections are paginated
  • Clean Layout: Well-organized, readable output
  • Dark/Light Themes: Choose your preferred color scheme

Screenshots

Screenshot 2025-11-07 at 11 42 52 AM