Before getting started
First, make sure you have Ruby and Ruby on Rails installed on your computer.
Second, make sure your command prompt is showing the location on your computer where you want this new Rails app to be created.
Take a look at the command line below:
joel@Joels-MacBook-Pro-16 projects %
Create the project
joel@Joels-MacBook-Pro-16 projects % rails new grand-prix
That’s it. When you run this command, a new directory (folder) titled ‘grand-prix’ will be created with the following directories and files (folders below are noted with the ‘/‘ at the end of the name):
– app/
– bin/
– config/
– config.ru
– db/
– Dockerfile
– Gemfile
– Gemfile.lock
– lib/
– log/
– public/
– Rakefile
– README.md
– storage/
– test/
– tmp/
– vendor/
– .dockerignore
– .gitattrubutes
– .gitignore
– .ruby-version
This set of files and folders has created a (very) basic rails app, and you can run it immediately.
Viewing the project
Next you’ll need to navigate into the project folder you just created. A quick way to do this is to enter the command
cd <the name of the project you just created>
joel@Joels-MacBook-Pro-16 gand-prix % rails server
joel@Joels-MacBook-Pro-16 grand-prix % rails server => Booting Puma => Rails 7.1.3.2 application starting in development => Run `bin/rails server --help` for more startup options Puma starting in single mode... * Puma version: 6.4.2 (ruby 3.3.0-p0) ("The Eagle of Durango") * Min threads: 5 * Max threads: 5 * Environment: development * PID: 48667 * Listening on http://127.0.0.1:3000 * Listening on http://[::1]:3000 Use Ctrl-C to stop
To see your app running, visit that link `https://127.0.0.1:3000`. This will open a web browser and display the following image (or similar, again, depending on the exact version of Rails you are running):
Bam. You’ve created a Ruby on Rails app.
—
More at world.hey.com/joelga