rails/guides
Yasuo Honda 4ab320adeb Pin sqlite3 version in bug_report_templates
This commit addresses the CI failure at https://buildkite.com/rails/rails-nightly/builds/424#018eee82-61fb-41ae-bc2b-21bc60dde483/1240

Since https://rubygems.org/gems/sqlite3/versions/2.0.0 has been released, while Rails application just allows sqlite3 gem version 1.*
some of bug_report_templates does not have the same version requirement. these bug report templates attemp to install the latest sqlite3 version 2.0.0, it raises the LoadError.

This version requiremnt is taken from that for Rails application.
0601929486/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb (L14)
0601929486/railties/lib/rails/generators/database.rb (L19)

Gemfile for Rails framework has different version requirement, this commit uses the version requirement for Rails application. Both of them eventually install the sqlite3 1.*.
0601929486/Gemfile (L157)

- Steps to reproduce
```
git clone https://github.com/rails/rails
cd guides/bug_report_templates
ruby action_mailbox.rb
ruby active_record.rb
ruby active_record_migrations.rb
ruby active_storage.rb
```

- Error without this commit
```
$ ruby action_mailbox.rb
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
-- create_table(:active_storage_blobs, {:id=>:primary_key})
/home/yahonda/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/bundler/rubygems_integration.rb:237:in `block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.0-x86_64-linux-gnu. Make sure all dependencies are added to Gemfile. (LoadError)
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `<top (required)>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:333:in `resolve_pool_config'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:134:in `establish_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/railtie.rb:304:in `block (2 levels) in <class:Railtie>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:338:in `<module:ActiveRecord>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:15:in `<top (required)>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `migration_class'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1032:in `connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1037:in `block in method_missing'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `block in say_with_time'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/benchmark.rb:298:in `measure'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `say_with_time'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1036:in `method_missing'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:566:in `create_table'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration/compatibility.rb:110:in `create_table'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/db/migrate/20170806125915_create_active_storage_tables.rb:6:in `change'
	from action_mailbox.rb:51:in `block in <main>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `instance_eval'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `define'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:50:in `define'
	from action_mailbox.rb:50:in `<main>'
/home/yahonda/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/bundler/rubygems_integration.rb:237:in `block (2 levels) in replace_gem': can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.0-x86_64-linux-gnu. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `<top (required)>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:333:in `resolve_pool_config'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:134:in `establish_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/railtie.rb:304:in `block (2 levels) in <class:Railtie>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:338:in `<module:ActiveRecord>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:15:in `<top (required)>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `migration_class'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1032:in `connection'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1037:in `block in method_missing'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `block in say_with_time'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/benchmark.rb:298:in `measure'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `say_with_time'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1036:in `method_missing'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:566:in `create_table'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration/compatibility.rb:110:in `create_table'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/db/migrate/20170806125915_create_active_storage_tables.rb:6:in `change'
	from action_mailbox.rb:51:in `block in <main>'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `instance_eval'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `define'
	from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:50:in `define'
	from action_mailbox.rb:50:in `<main>'
$
```
2024-04-18 09:48:41 +09:00
..
assets Merge pull request #51536 from jathayde/scrollbar-color-fix 2024-04-10 09:56:18 -03:00
bug_report_templates Pin sqlite3 version in bug_report_templates 2024-04-18 09:48:41 +09:00
rails_guides Remove example filepaths from code blocks in guides 2024-04-09 17:01:29 +02:00
source [RF-DOCS] Review Action View Overview Guide (#51435) 2024-04-11 16:19:07 -03:00
.document adds guides/.document to tell rdoc not to process this directory 2013-03-04 22:28:23 +01:00
.rubocop.yml Document response.parsed_body in 7.1 release notes 2023-08-23 15:33:52 -04:00
CHANGELOG.md Development of Rails 7.2 starts now 2023-09-27 03:59:11 +00:00
rails_guides.rb Replaces mobi guide with epub for docs because of discontinued support 2022-08-05 00:18:20 +05:30
Rakefile Use version of importmap that support loading outside of an app 2023-10-27 20:23:42 +00:00
README.md Fixed typo in guides/README.md 2024-03-28 21:51:23 +09:00
w3c_validator.rb Use frozen string literal in guides/ 2017-08-13 22:04:09 +09:00

Rails Guides Redesign 2024

About the Project

The Rails Guides Visual Refresh occurred in Q1 2024, and was intended to bring the visual style of the guides inline with the rubyonrails.org site.

Editing Dependencies

The editing files for the Guides rebuild reside in stylesrc and use SCSS to improve developer experience. The code base relies on include_media (https://eduardoboucas.github.io/include-media/) to enable inline media-queries adjustments. We've also relied on the standard normalize.css (https://necolas.github.io/normalize.css/) to help bring all browsers together.

Building the Guides in Development

To generate new guides into static files, type rake guides:generate from inside the guides folder. If you make changes to the HTML or ERB, you'll need to remove the "output" directory before running this command. The master SCSS files (style.scss, highlight.scss) will compile as part of this process.

FAQ

Why are you not using CSS variables?

Per the MDN documentation on CSS custom properties (https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), they are not supported in media or container queries at this point (Feb 2024). They may in future releases, and we should pivot to that when they are more wholistically supported. SCSS variables, because they are interpolated at build, serve a similar purpose and allow us the flexibility to support much older browsers.

Why do we include LTR and RTL?

LTR/RTL (Left to right/right to left) is a layout change based on the nature of the language the site is being displayed in. Arabic and Farsi are two well known "RTL" languages. If the site is automatically translated, then the layout will adjust (mirror horizontally) to be more in line with the text.

Why is Dark Mode in a separate file

IncludeMedia does not handle prefers-color-scheme at this time, so it was extracted.