Create Rails Projetc

Step 1: Install Ruby and Rails

# Install Ruby using a version manager (e.g., RVM)
\curl -sSL https://get.rvm.io | bash -s stable --ruby

# Install Rails using gem
gem install rails

Step 2: Create a new Rails project

# Replace 'my_project' with your desired project name
rails new my_project

Step 3: Navigate to the project directory

cd my_project

Step 4: Create a new controller (optional)

# Replace 'example' with your desired controller name
rails generate controller example

Step 5: Start the Rails server

rails server

Step 6: Open a web browser and navigate to http://localhost:3000

# Open your default web browser
xdg-open http://localhost:3000 # for Linux
open http://localhost:3000     # for macOS
start http://localhost:3000    # for Windows

Step 7: Stop the Rails server (when done)

# Press Ctrl+C in the terminal where the server is running

You've now created a new Ruby on Rails project, optionally generated a controller, started the Rails server, and accessed the default welcome page in your web browser.