This is a base Ruby on Rails repository configured for learning with Codespaces (and Gitpod).
- Ruby version:
3.2.1
- Rails version:
7.1.3.3
We've added additional Ruby gems and other software that aren't automatically available in a new Rails app, and configured
In Rails version 7, support for Unobtrusive JavaScript (UJS) is not the default. Rather, this has been replaced with Turbo.
However, in AppDev, we typically want to first demonstrate UJS and then enable Turbo manually when we want it.
Therefore, UJS has been pre-configured here with these steps:
-
Pin UJS + jQuery in
config/importmap.rb
by running:% ./bin/importmap pin @rails/ujs % ./bin/importmap pin jquery
-
Add UJS + jQuery via:
// app/javascript/application.js import jquery from "jquery"; window.jQuery = jquery; window.$ = jquery; import Rails from "@rails/ujs" Rails.start();
UJS and Turbo can co-exist side-by-side with these instructions, which we already implemented here.
By default, Turbo is disabled via:
// app/javascript/application.js
import { Turbo } from "@hotwired/turbo-rails"
Turbo.session.drive = false
Set it to true
to enable Turbo everywhere, or you can use data-turbo="true"
to enable Drive on a per-element basis while leaving it globally false
.
appdev_support
annotate
awesome_print
better_errors
binding_of_caller
dotenv-rails
draft_generators
draft_matchers
devise
faker
grade_runner
htmlbeautifier
http
pry_rails
rails_db
rails-erd
rspec-html-matchers
rspec-rails
rufo
specs_to_readme
table_print
web_git
webmock
- OS Ubuntu 20.04.5 LTS
- Chromedriver
- Fly.io's
flyctl
- Google Chrome (headless browser)
- Graphviz
- Node JS 18
- NPM 8.19.3
- Postgresql 12
- Redis
- Yarn
- vortizhe.simple-ruby-erb
- mbessey.vscode-rufo
- aliariff.vscode-erb-beautify
- eamodio.gitlens
- setobiralo.erb-commenter
Run the database migrations before loading sample data:
bundle install
rails db:create db:migrate
rake sample_data
Ensure that an OPENAI_API_KEY
environment variable is set with your OpenAI API key for librarian chat features.
If you see an error like Errno::ENOENT @ rb_sysopen - 0.0.0.0
when submitting a question to the librarian chat, double check that OPENAI_API_KEY
is pointing to your actual API key value and not a placeholder such as 0.0.0.0
.