Creating all rails applications in the same way. To create an rails application create a directory and inside the directory run your rails command
rails new my_first_app
As seen on the above animation a skeleton is created. In this skeleton.
|app/||This is the core part of the application. This is the place contains models, views, containers|
|app/assets||Which is the place Java Script, CSS and images to be include|
|config/||Application Configuration like database configuration, routing…|
|public/||The assets accessible by public ( Error pages … )|
|test/||application test files|
|vendor/||3rd party plugin and Gems|
|README.rdoc||A brief description of Application|
|config.ru||Configuration file for Rake middleware|
When we finish the application creation we are using bundle command to install the application and getting the required Gems to the app. The command bundle install is responsible for the installation it is automatically runs on your creation time.
Note: If you made any changes on Gemfile. You should run the bundle install command to update/install your gems to your application.
In Gem you may notice some Gems specified with version number and some are not. Unless you specify the version number Gem getting the latest version of the specified Gems. You can explicit the version specifying the version number.
to specify the version as second parameter
gem ‘jquery-rails’, ‘2.0.0’
And also you can specify the particular gem to an particular group environment. Let say we are going to use the sqllite only to the development environment. You specify the Gem as follow.
group :development do
gem ‘sqlite3’, ‘1.3.5’
Once you assemble the Gemfile don’t forget to install the Gems inside the application.
Until now we have know the two important rails commands rails new and bundle install. Now we are going to see how to run our application. Specially rails comes with a command line with local web server on your development environment.
The following command shows you how to run your rails application on your local machine.
After running your application, Go to your browser with http://localhost:3000/ You will see the welcome page of rails as below