0
0
Ruby on Railsframework~10 mins

First Rails application - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - First Rails application
Run 'rails new app_name'
Rails creates folder structure
Navigate to app folder
Run 'rails server'
Server starts and listens
Open browser at localhost:3000
Rails serves default welcome page
This flow shows how to create a new Rails app, start the server, and see the default page in the browser.
Execution Sample
Ruby on Rails
rails new myapp
cd myapp
rails server
Creates a new Rails app named 'myapp', moves into its folder, and starts the Rails server.
Execution Table
StepCommand/ActionSystem ResponseResult
1rails new myappCreates app folder and filesFolder 'myapp' with Rails structure created
2cd myappChanges directoryCurrent folder is 'myapp'
3rails serverStarts Rails serverServer listens on http://localhost:3000
4Open browser at http://localhost:3000Server respondsDefault Rails welcome page shown
5Stop server (Ctrl+C)Server stopsNo longer listening on port 3000
💡 Server stops when user interrupts; app folder and files remain for development.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Current DirectoryUser homemyapp created but not enteredmyappmyappmyappmyapp
Rails Server StatusStoppedStoppedStoppedRunningRunningStopped
Browser PageNoneNoneNoneNoneRails Welcome PageNone
Key Moments - 3 Insights
Why do we need to run 'cd myapp' after creating the app?
Because 'rails new' creates the app folder but does not move you inside it. You must 'cd' to run commands like 'rails server' inside the app.
What happens if you open the browser before starting the server?
The browser will not connect because the Rails server is not running yet. See step 4 in execution_table where the server must be running first.
Why does the default page show a welcome message?
Rails includes a default welcome page to confirm the server works. This is shown at step 4 when accessing localhost:3000.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the system response after running 'rails new myapp'?
AStarts Rails server
BCreates app folder and files
CChanges directory
DServer stops
💡 Hint
Check step 1 in the execution_table for the response to 'rails new myapp'.
At which step does the Rails server start running?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Look at the 'Rails Server Status' in variable_tracker and the 'System Response' in execution_table.
If you skip 'cd myapp' and run 'rails server' from the home folder, what happens?
AError because no Rails app found
BServer starts normally
CCreates new app automatically
DShows default welcome page
💡 Hint
Refer to key_moments about why 'cd myapp' is needed before running 'rails server'.
Concept Snapshot
rails new app_name  # creates new app folder and files
cd app_name          # move into app folder
rails server         # start Rails server
Open browser at localhost:3000 to see default welcome page
Stop server with Ctrl+C
This sets up your first Rails app ready for development.
Full Transcript
To create your first Rails application, you start by running 'rails new' with your app name. This command creates a folder with all necessary files. Next, you must change directory into the new app folder using 'cd'. Then, start the Rails server with 'rails server'. The server listens on localhost port 3000. Opening your browser to this address shows the default Rails welcome page, confirming the server runs correctly. When finished, stop the server with Ctrl+C. This process sets up your first Rails app ready for further development.