📜  Ruby on Rails目录结构

📅  最后修改于: 2021-01-12 02:38:41             🧑  作者: Mango

Ruby on Rails目录结构

创建Rails应用程序时,将创建整个Rails目录结构。我们将在这里解释Rails 5目录结构。

jtp目录(如下所示)具有许多自动生成的文件和文件夹,其中包括Rails应用程序的结构。

我们将解释上述目录中每个文件和文件夹的函数。

File/Folder Description
app It works as the remainder of this directory. Basically it organizes our application component. It holds MVC.
app/assets This folder contains static files required for application’s front-end grouped into folders based on their type.
app/controllers All the controller files are stored here. A controller handles all the web requests from the user.
app/helpers It contains all the helper functions to assist MVC.
app/mailers It contains mail specific functions for the application.
app/models It contains the models and data stored in our application’s database.
app/views This folder contains the display templates to fill data in our application.
bin It basically contains Rails script that start your app. It can also contain other scripts use to setup, upgrade or run the app.
config It configures our application’s database, routes and more.
db It contains our current database schema and database migrations.
lib It contains extended module for your application.
log It contains application log files.
public It contains static files and compiled assets. This is the only folder seen by the world.
test It contains unit tests, other test apparatus and fixtures.
tmp It contains temporary files like cache and pid files.
vendor It contains all third-party code like vendor gems.
Gemfile Here all your app’s gem dependencies are declared. It is mandatory as it includes Rails core gems among other gems.
Gemfile.lock It holds gems dependency tree including all versions for the app.
README.md It is a brief instruction manual for your application.
Rakefile It locates and loads tasks that can be run from the command line.
config.ru Rack configuration for Rack based servers used to start the application.