Create Your first Test Ruby On Rails Project

Step 1: Start Command Prompt with Ruby (By using start >> All Programs >> Start command prompt with ruby)
Step 2: Run the below command
rails new testproject -d mysql

This command will create necessary code frame / Directory Structure for this project in the desired directory. Also you are telling that this project is just
going to consume Mysql as database.

Step 3: edit the database.yml (Under Project Root/ config/database.yml) file and replace every instance of “mysql2″ by “mysql”. Then save the file.

Step 4: cd project path to reach there command will be like this
cd C:/users/admin/testproject

Step 5.
Run command “bundle install
This command will install all necessary things for your project

Step 6: We can now create CRUD operations for a simple user table. So by executing the below:
rails generate scaffold user name:string email:string

Step 7: Actual changes in database will take plce by running below command:
rake db:create
rake db:migrate
Step 8: let us run the Rails httpd server:
rails server

Open your browser and go to: http://localhost:3000/users to see working example

Related posts:

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video... Read More about Chandra Shekhar

Latest posts by Chandra Shekhar (see all)