Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.ico binary
*.jpg binary
*.gif binary
*.png binary
*.swf binary
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/structure.sql linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
30 changes: 25 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,35 @@
# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

# Ignore master key for decrypting credentials and more.
/config/master.key

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-*
/db/*.zip

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
# Ignore all environment files.
/.env
/.env.*

# gemini-cli settings
.gemini/
Expand Down
112 changes: 112 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,118 @@ end
- `client_ip`, `client_identity` - Track users
- `md_to_html` - Markdown rendering

## Rails Upgrade Workflow

**CRITICAL REFERENCE:** This project has comprehensive Rails Upgrade Guidelines in `README.md`. **ALWAYS read and follow README.md Rails Upgrade Guidelines before starting any Rails upgrade.**

### Step-by-Step Rails Upgrade Process

When asked to upgrade Rails, follow this exact workflow:

1. **Read README.md Guidelines First**
- Open and read the "Rails Upgrade Guidelines" section in README.md
- Understand the upgrade path methodology
- Note the complete diff application rules

2. **Plan the Upgrade Path**
- Determine current Rails version (check `Gemfile.lock`)
- Determine target Rails version
- Create step-by-step upgrade path following major version increments
- Example: 4.2.5 → 4.2.11 → 5.0.0 → 5.2.8 → 6.0.0 → 6.1.7

3. **For EACH Major Version Step**

**A. Visit railsdiff.org**
- Open the exact URL: `https://railsdiff.org/{from_version}/{to_version}`
- Review ALL file changes in the diff
- Make a mental note of:
- Files to modify
- **Files to create (marked as "new file")**
- Files to delete
- Directory structure changes

**B. Update Gemfile**
- Update Rails version
- Update related gems if needed for compatibility
- Run `bundle update rails`

**C. Apply ALL railsdiff.org Changes**

**CRITICAL: Copy files EXACTLY as shown in railsdiff.org, including:**
- All code lines
- **ALL comments** (even if they look like documentation or examples)
- All whitespace and formatting
- All empty lines

**Must create these files if they don't exist (with EXACT content from railsdiff.org):**
- `config/cable.yml` (Rails 5.0+)
- `config/storage.yml` (Rails 5.2+)
- `config/initializers/content_security_policy.rb` (Rails 5.2+)
- `config/initializers/permissions_policy.rb` (Rails 6.1+)
- `config/initializers/new_framework_defaults_X_Y.rb` (each major version)
- `bin/update` (Rails 5.0+)
- `app/models/application_record.rb` (Rails 5.0+)
- `app/jobs/application_job.rb` (Rails 5.0+) - **including retry_on and discard_on comments**
- `app/mailers/application_mailer.rb` (Rails 5.0+)
- `app/views/layouts/mailer.html.erb` and `.text.erb` (Rails 5.0+)

**Must update these files:**
- `.gitattributes` - Update to Rails standard format
- `.gitignore` - Add new ignore patterns (storage/, tmp/storage/, config/master.key, etc.)
- `bin/rails`, `bin/rake`, `bin/setup` - Update to modern format (remove `.exe`, use `__dir__`)
- `config/application.rb` - Update `config.load_defaults`
- `config/boot.rb` - Update requires, add bootsnap
- `config/environment.rb` - Update requires to use `require_relative`
- `config/puma.rb` - Update to Rails 6.1 format
- `config/environments/*.rb` - Add all new configuration options
- `config/database.yml` - Update comments and format if needed

**Must create directory structure:**
- `tmp/.keep`, `tmp/pids/.keep`, `tmp/storage/.keep`
- `storage/.keep`

**D. Verification Checklist**
- [ ] All files marked "new file" in railsdiff.org are created **with EXACT content including ALL comments**
- [ ] All files marked "modified" in railsdiff.org are updated **line by line, including comment changes**
- [ ] .gitattributes updated to Rails standard
- [ ] .gitignore includes all new patterns
- [ ] All bin/ scripts use modern format
- [ ] config/application.rb has correct load_defaults version
- [ ] All new initializers are created
- [ ] Directory structure is complete
- [ ] **Content verification**: For new files (especially ApplicationJob, ApplicationRecord, ApplicationMailer), verify comments match railsdiff.org

**E. Commit Changes**
- Commit gem updates separately from config updates
- Use descriptive commit messages
- Follow the commit message format from previous upgrades

4. **After All Upgrades Complete**
- Review all commits
- Ensure no files were missed
- Push to remote branch

### Common Mistakes to Avoid

❌ **DO NOT:**
- Skip creating new files from railsdiff.org
- Only update gems without applying config changes
- Assume existing files are sufficient
- Skip updating .gitattributes or .gitignore
- Forget to create new initializers
- Leave bin/ scripts in old format
- **Create files from memory/common knowledge - ALWAYS copy from railsdiff.org**
- **Skip comments thinking they are optional - ALL comments must be included**
- Create minimal/skeleton versions of files - use EXACT content

✓ **DO:**
- Create EVERY file marked as "new file" in railsdiff.org **with EXACT content**
- Update EVERY file marked as "modified" in railsdiff.org **line by line**
- **Include ALL comments, even if they look like documentation or examples**
- Use the verification checklist for each version
- Ask user if uncertain about any file
- Follow the README.md guidelines strictly

## Development Workflow

### Getting Started
Expand Down
34 changes: 17 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ group :production do
end

# Use dotenv for environment variables management
gem 'dotenv-rails'
gem 'dotenv-rails', '~> 2.7'
# Use Puma as the app server
gem 'puma'
# Use pry-rails for pry initializer
Expand All @@ -29,26 +29,28 @@ gem 'redis-rails'
# Use Rack CORS Middleware for handling CORS
gem 'rack-cors', require: 'rack/cors'
# Use Simple Form as form builder
gem 'simple_form'
gem 'simple_form', '~> 5.0'
# Use Slim for template
gem 'slim-rails'
gem 'slim-rails', '>= 3.1.0'
# Use Ransack as search model
gem 'ransack'
# Use HTTParty as an HTTP client
gem 'httparty'
# Use fog-google for Google Cloud Platform
gem 'fog-google'
gem 'fog-google', '~> 1.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.5'
gem 'rails', '~> 6.1.7'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
gem 'pg', '~> 0.21'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'sass-rails', '>= 6.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'coffee-rails', '~> 4.2.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

Expand All @@ -57,7 +59,7 @@ gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'jbuilder', '~> 2.5'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

Expand All @@ -71,18 +73,18 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# gem 'capistrano-rails', group: :development

# Use rails-i18n as I18n solution
gem 'rails-i18n'
gem 'rails-i18n', '~> 7.0'
# Use Kaminari as paginator
gem 'kaminari'
# Use Nokogiri as HTML parser
gem 'nokogiri'
# Use Nokogiri as HTML parser (< 1.13 for Ruby 2.5 compatibility)
gem 'nokogiri', '~> 1.12.0'
# Use Redcarpet as Markdown parser
gem 'redcarpet'
# Use CodeRay for syntax highlighting
gem 'coderay'

# Use amazon-ecs for Amazon Product Advertising API
gem 'amazon-ecs'
gem 'amazon-ecs', '~> 2.6'
# Use http_accept_language help detect the users preferred language
gem 'http_accept_language'

Expand All @@ -103,6 +105,8 @@ end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Required for assigns and assert_template in tests
gem 'rails-controller-testing'
end

group :development do
Expand All @@ -119,10 +123,6 @@ group :development do

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# Use Quiet Assets to mute assets pipeline log messages
gem 'quiet_assets'
# Use RealFaviconGenerator as favicon generator
gem 'rails_real_favicon'
# Use RuboCop for Ruby code analysis
gem 'rubocop', require: false
end
Loading