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:
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments