Bootstrap for Rails
上QQ阅读APP看书,第一时间看更新

Analyzing folder structure of a Rails application

Let's navigate to the TODO folder to check how our application's folder structure looks like:

Analyzing folder structure of a Rails application

Let me explain to you some of the important folders here:

  • The first one is the app folder, which we will be focusing on the most throughout this book. All our application's content will be present inside this folder.
  • The assets folder inside the app folder is the location to store all the static files like JavaScript, CSS, and Images. You can take a sneak peek inside them to look at the various files.
  • The controllers folder handles various requests and responses of the browser.
  • The helpers folder contains various helper methods both for the views and controllers.
  • The next folder mailers, contains all the necessary files to send an e-mail.
  • The models folder contains files that interact with the database.
  • Finally, we have the views folder, which contains all the .erb files that will be complied to HTML files.

So, let's start the Rails server and check out our application on the browser:

  1. Navigate to the TODO folder in the terminal and then type the following command to start a server:
    rails server
    

    You can also use the following command:

    rails s
    
  2. You will see that the server is deployed under the port 3000. So, type the following URL to view the application:

    http://localhost:3000.

    You can also use the following URL: http://0.0.0.0:3000.

  3. If your application is properly set up, you should see the default page of Rails in the browser:
    Analyzing folder structure of a Rails application