Rails 7 Workspaces
Description / Purpose
Instead of using the default Rails setup, we have a custom template that works well in our environment. This article explains how and why we use it. This applies to the
rails-7 workspace type.
Making a new app
When making a new Rails app for an exercise or project, do NOT generate the app on your computer. Use
rails new within the Learning Environment.
If you're curious about the details:
rails newis aliased with additional arguments so that it skips some unnecessary steps and uses a custom template. If you have access, you can view the alias in our GitHub repository, or run
nano $(which rails)
- The custom template configures the application to work in our environment and use our managed set of gems. If you have access, you can view the template.rb file in our GitHub repository, or run
Working with gems
To manage dependencies and reduce startup time for learners, we maintain gems at the Dockerfile level: when we build the Docker image for this workspace, we pre-install the gems. This has a few benefits:
- Learners never need to run
- Generating a new rails application is faster
- The list of dependencies used across our Rails content is known and managed in version control
- The same version of each gem is guaranteed over time
If you'd like another Gem installed in the workspace, do NOT run
gem install. Please ask your friendly Engineering team for help.