This chapter will talk about how we create an application using Rails framework using simple and efficient examples. For example we will create something simple but operational online library system for holding and managing the books.
One must be patient enough to learn as it is a bit tough going through next few chapters but not difficult.
Online library system application (Example) has a basic architecture and will be built using two ActiveRecord models to explain the types of data that is stored in your database
Below is the suggested workflow for creating Rails applications
Rails works as a runtime web application framework and also as a helper script, which automates a lot of things when user developing a web application.
Here, let’s know how to use Rails helper script to create the directory structure and the primary set of files to start our Library System Application.
Using this command can create a subdirectory for the library application, which contains a whole directory tree of folders and files for an empty Rails application.
Let’s use MySQL database here –d mysql. User can use other databases like oracle or postgressusing -d option. Rails uses SQLite database as default database.
Below describes how user can create and edit the files in the~/library/app subdirectories. In Rails major part of the app development includes in creating and editing subdirectories.
WEBrick is the default web server which comes with Rails framework. But Rails web application will run under virtually any web server. Using the built-in WEBrick web server to build and test a Rails web application is easy way.
WEBrick server will start from the app directory as follows, which runs on port number 3000.
Once the above command is entered, WEBrick web server starts to listen for Web Requests at port number 3000 at local machine.
User should open browser and browse to http://127.0.0.1:3000 and should see a greeting message from WEBrick web server.
If user cannot see a greeting message from web server as shown in the screen, check to see the whole setup and should be fixed if any errors while setting up before proceeding further.
The next session would include the topics on how user can create databases for their application and how access the created databases, and then we learn about what is Rail Migration and its use in maintain the DB tables.
Ruby on Rails 2.1 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|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.