优化Ruby on Rails项目

时间:2022-07-09 20:42:17

I'm busy creating a very simplistic ruby on rails app that won't need a lot things that are loaded in the ruby on rails environment by default.

我正忙于在rails应用程序上创建一个非常简单的ruby,默认情况下不需要在rails环境中加载ruby中的很多东西。

I won't be using mysql, just one model that fetches data from a Yaml file. So I'm thinking I won't be needing ActiveRecord, or at least a large part of it. ( Correct me if I'm wrong here );

我不会使用mysql,只是一个从Yaml文件中获取数据的模型。所以我想我不会需要ActiveRecord,或者至少是其中很大一部分。 (如果我错了,请纠正我);

How do I go about purging all the unneeded things from my app.
( Like stopping the app from looking in /config/database.yml for config which I won't need )

如何从我的应用程序中清除所有不需要的东西。 (就像阻止应用程序在/config/database.yml中查找我不需要的配置)

And, when I'm all done, how do I figure out what things are loaded, but not needed? example: ActionMailer.

而且,当我完成所有工作后,如何确定装载的东西,但不需要?示例:ActionMailer。

Thanks,
Steve

1 个解决方案

#1


In your environment.rb - File:

在你的environment.rb中 - 文件:

 # Skip frameworks you're not going to use. To use Rails without a database,
 # you must remove the Active Record framework.
 config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

#1


In your environment.rb - File:

在你的environment.rb中 - 文件:

 # Skip frameworks you're not going to use. To use Rails without a database,
 # you must remove the Active Record framework.
 config.frameworks -= [ :active_record, :active_resource, :action_mailer ]