A web application development framework, Rails is written in the Ruby programming language. It helps in making programming web applications easier by suggesting possibilities essential for every developer to get started. It allows users to write a minimum line of code to accomplish a better output as compared to other languages and frameworks. Several experienced Rails developers have also reported that it makes web application development easy and fun.
Requirement for building new rails app:
- Databases (MySQL or PostgreSQL)
Listed below are the commands for building a new rails app:
- $ rails new demo app
This command enables developers to write on the created terminal rails app files. While writing the above command, spell check and then go ahead and hit the enter button after entering the command.
- $ rails new demo app -d MySQL
With this command, the developer can bind the database which he wants to bind with the rails app. To execute this, after the application name, simply add on the terminal “-d MySQL”. This binds the database and creates the required files.
- $ cd demo app
After switching the folder, there will appear many files and a directory that contains several generated files and folders that form the structure of the rails application.
Contains models, views, controllers, helpers, mailers, channels, jobs, and assets for the Rails application.
Contains the rails script required to start the application and other scripts required to set up, update, deploy, and run the application.
The above screenshot highlights the file structure of a new rails app.
- $ rails s
The above command is used to the start rails server on web host: https//localhost:3000