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

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 Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...