0
0
Ruby on Railsframework~5 mins

First Rails application

Choose your learning style9 modes available
Introduction

Rails helps you build websites quickly by giving you ready tools. Creating your first Rails app shows you how to start making web pages.

You want to make a simple website to share information.
You want to learn how web apps work with Ruby and Rails.
You want to build a project that can grow with more features later.
You want to try out Rails commands and see how files are organized.
Syntax
Ruby on Rails
rails new app_name
cd app_name
rails server

rails new app_name creates a new Rails project folder.

rails server starts a local web server to see your app in a browser.

Examples
This creates a new app called 'blog', moves into its folder, and starts the server.
Ruby on Rails
rails new blog
cd blog
rails server
This creates a new app called 'shop' but skips test files to keep it simple.
Ruby on Rails
rails new shop --skip-test
cd shop
rails server
Sample Program

This example shows how to create a new Rails app named 'hello_world'. Running the server lets you open the app in your browser and see the default welcome page.

Ruby on Rails
# Terminal commands to create and run a Rails app
rails new hello_world
cd hello_world
rails server

# After server starts, open browser at http://localhost:3000
# You will see the Rails welcome page with 'Yay! You're on Rails!' message.
OutputSuccess
Important Notes

Make sure Ruby and Rails are installed before starting.

Use Ctrl+C in the terminal to stop the Rails server.

The default Rails welcome page confirms your app is set up correctly.

Summary

Rails makes web app setup fast and easy.

Use rails new to create your app folder.

Run rails server to see your app in a browser.