Let us move on with the workflow for creating Rails Application. We have already seen how to create an empty rails web application and how to start web server. Before we get into the next step, make sure your database server is up and running. It is recommended to create three databases - a database each for development, testing, and production environment which are named as follows as per convention －
Initialize all three of them and create a user and password for them with full read and write privileges. We are using the root user ID for our application.
In MySQL, we are using the root user ID for our application. This is how the MySQL console session in which you do this looks like −
Repeat the same for two the other two databases – library_production and library_test.
Now, you need to let Rails know about the user name and password for the databases. This is to be done in the file database.yml in the libraryconfig subdirectory of Rails Application you created. It has live configuration sections for MySQL databases. Remember to change the username and password lines in each of the sections you use, to reflect the permissions on the databases you've created .
This is how it should look once you are done －
By default, PostgreSQL does not provide any users. So let us create new users using the following command with the name rubyuser.
Use the following command if you want to create a password for the created new user
Use the following command for creating a database library_development.
Use the following command for creating a database library_production.
Use the following command for creating a database library_test.
Use Ctrl+D to terminate PosgreSQL.
Configure PostgreSQL database like you configured MySQL database. Let Rails know the username and password for the databases in the file database.yml, available in the libraryconfig subdirectory of Rails Application you created. This file has live configuration sections for PostgreSQL databases. In each of the sections, you need to change the username and password lines to reflect the permissions on the databases you've created.
Ruby on Rails Related Interview Questions
|Python Interview Questions||HTML 5 Interview Questions|
|PHP Interview Questions||PostgreSQL Interview Questions|
|Ruby Interview Questions||Django Interview Questions|
|wxPython Interview Questions||MongoDB Interview Questions|
|Python Automation Testing Interview Questions||GitHub Interview Questions|
|Ruby Sinatra Interview Questions|
Ruby On Rails Tutorial
Ruby On Rails
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.