Skip to content

newstler/why_ruby

Repository files navigation

WhyRuby.info - Ruby Advocacy Community Website

A community-driven Ruby advocacy website built with Ruby 4.0.0 and Rails 8.2 using the Solid Stack (SQLite, SolidQueue, SolidCache, SolidCable).

Features

Core Features

  • Universal Content Model: Support for both articles (with markdown) and external links
  • GitHub OAuth Authentication: Sign in with GitHub account only
  • Category System: Dynamic categories managed through admin panel
  • Tagging System: HABTM relationship for content tagging
  • Pinned Content: Homepage featuring system with numbered positions
  • AI-Generated Summaries: Automatic content summarization via OpenAI
  • Soft Deletion: All records use archived flag instead of hard deletion

Community Features

  • Role-Based Access: Member and admin roles
  • Trusted User System: Based on contribution count (3+ contents, 10+ comments)
  • Self-Regulation: Trusted users can report inappropriate content
  • Auto-Moderation: Content auto-hidden after 3+ reports
  • Markdown Support: Full markdown rendering with syntax highlighting

Setup

Prerequisites

  • Ruby 4.0.0
  • SQLite 3
  • Node.js (for JavaScript runtime)

Installation

  1. Clone the repository:
git clone <repository-url>
cd why_ruby
  1. Install dependencies:
bundle install
  1. Create and setup the database:
rails db:create
rails db:migrate
rails db:seed
  1. Set up Rails credentials for development:
rails credentials:edit --environment development

Add your credentials:

github:
  client_id: your_github_client_id
  client_secret: your_github_client_secret

openai:
  api_key: your_openai_api_key  # Optional

Get credentials from:

GitHub OAuth Setup

  1. Go to GitHub Settings > Developer settings > OAuth Apps
  2. Click "New OAuth App"
  3. Fill in the application details:
  4. Click "Register application"
  5. Copy the Client ID and Client Secret to your Rails credentials

Running the Application

Start the Rails server:

rails server

Visit http://localhost:3000

Admin Access

The seed data creates a test admin user. In production, you'll need to:

  1. Sign in with GitHub
  2. Use rails console to promote your user to admin:
rails runner "User.find_by(username: 'your-github-username').update!(role: :admin)"

Access the admin panel at /admin

Architecture

Models

  • User: GitHub OAuth authenticated users with roles
  • Category: Content categories with position ordering
  • Content: Universal model for articles and links
  • Tag: Content tags with HABTM relationship
  • Comment: User comments on content
  • Report: Content reports from trusted users

Key Technologies

  • Rails 8.1: Latest Rails with Solid Stack
  • SQLite with ULID: Primary keys using ULID for better distribution
  • Tailwind CSS 4: Modern utility-first CSS framework
  • Redcarpet + Rouge: Markdown rendering with syntax highlighting
  • Avo: Admin interface for content management
  • Kaminari: Pagination
  • SolidQueue: Background job processing

Background Jobs

  • GenerateSummaryJob: Creates AI summaries for new content
  • NotifyAdminJob: Alerts admins when content is auto-hidden

Development

Running Tests

rails test

Code Style

bundle exec rubocop

Database Console

rails db

Deployment

This application is configured for deployment with Kamal. See config/deploy.yml for configuration.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is open source and available under the MIT License.

About

whyruby.info

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •