Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Getting Start With Rails guide to account for Dev Containers
This commit updates the Getting Started With Rails guide to cover using rails-new, Docker and VScode to create and run a new app in a Dev Container. The old instructions for installing Ruby and Rails locally on the developer's machine have been moved to their own guide, Installing Rials.
- Loading branch information
1 parent
cc9d0b9
commit 02f3c90
Showing
2 changed files
with
176 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.** | ||
|
||
Installing Rails | ||
================ | ||
|
||
After reading this guide, you will know: | ||
|
||
* How to install Rails | ||
* How to create a Rails application | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
This guide is for those who would like to install Rails on their local machine. | ||
See [Getting Started](getting_started.html) for the full guide to getting started | ||
with Rails, including working with Rails in a Dev Container, which is the quickest | ||
way to get started. | ||
|
||
The best way to read this guide is to follow it step by step. All steps are | ||
essential to run this example application and no additional code or steps are | ||
needed. | ||
|
||
NOTE: The examples below use `$` to represent your terminal prompt in a UNIX-like OS, | ||
though it may have been customized to appear differently. If you are using Windows, | ||
your prompt will look something like `C:\source_code>`. | ||
|
||
Installing dependencies | ||
----------------------- | ||
|
||
Before you install Rails, you should check to make sure that your system has the | ||
proper prerequisites installed. These include: | ||
|
||
* Ruby | ||
* SQLite3 | ||
|
||
### Installing Ruby | ||
|
||
Open up a command line prompt. On macOS open Terminal.app; on Windows choose | ||
"Run" from your Start menu and type `cmd.exe`. Any commands prefaced with a | ||
dollar sign `$` should be run in the command line. Verify that you have a | ||
current version of Ruby installed: | ||
|
||
```bash | ||
$ ruby --version | ||
ruby 3.1.0 | ||
``` | ||
|
||
Rails requires Ruby version 3.1.0 or later. It is preferred to use the latest Ruby version. | ||
If the version number returned is less than that number (such as 2.3.7, or 1.8.7), | ||
you'll need to install a fresh copy of Ruby. | ||
|
||
To install Rails on Windows, you'll first need to install [Ruby Installer](https://rubyinstaller.org/). | ||
|
||
For more installation methods for most Operating Systems take a look at | ||
[ruby-lang.org](https://www.ruby-lang.org/en/documentation/installation/). | ||
|
||
### Installing SQLite3 | ||
|
||
You will also need an installation of the SQLite3 database. | ||
Many popular UNIX-like OSes ship with an acceptable version of SQLite3. | ||
Others can find installation instructions at the [SQLite3 website](https://www.sqlite.org). | ||
|
||
Verify that it is correctly installed and in your load `PATH`: | ||
|
||
```bash | ||
$ sqlite3 --version | ||
``` | ||
|
||
The program should report its version. | ||
|
||
### Installing Rails | ||
|
||
To install Rails, use the `gem install` command provided by RubyGems: | ||
|
||
```bash | ||
$ gem install rails | ||
``` | ||
|
||
To verify that you have everything installed correctly, you should be able to | ||
run the following in a new terminal: | ||
|
||
```bash | ||
$ rails --version | ||
Rails 7.2.0 | ||
``` | ||
|
||
If it says something like "Rails 7.2.0", you are ready to continue. | ||
|
||
Creating an Application | ||
----------------------- | ||
|
||
To create a new Rails application, open a terminal, navigate to a directory where you have | ||
rights to create files, and run: | ||
|
||
```bash | ||
$ rails new blog | ||
``` | ||
|
||
This will create a Rails application called Blog in a `blog` directory and | ||
install the gem dependencies that are already mentioned in `Gemfile` using | ||
`bundle install`. | ||
|
||
TIP: You can see all of the command line options that the Rails application | ||
generator accepts by running `rails new --help`. | ||
|
||
After you create the blog application, switch to its folder: | ||
|
||
```bash | ||
$ cd blog | ||
``` | ||
|
||
Now you are ready to continue with the Getting Started guide, continuing from | ||
the [Hello, Rails!](getting-started.html#hello-rails-bang) section. |