Created
September 9, 2010 06:09
-
-
Save liwh/571463 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionRecord 配置 | |
整理出来方便查询 | |
1.ActionRecord:Base.logger=logger | |
接受一个logger对象。改对象被内部使用。用于记录数据库的操作。如果应用程序须记录数据库操作,也会使用这个logger对象。 | |
2.ActionRecord:Base.primary_key_prefix_type=option | |
如果option为nil.则所有表的缺省主键字段都是id,如果改选项值为:table_name,则会在"id"前面加上表名,如果改选值 为: | |
table_name_with_underscore,则会在表名与id之间以下画线分隔。 | |
3.ActionRecord:Base.table_name_prefix="prefix" | |
在表名前面加上指定的字符串。譬如说,如果模型类叫做User,前缀字符串是"myapp-",则Rails会寻找名为"myapp- users"的表,如果 | |
需要与别的应用程序共享数据库,或者必须用同一个数据库进行并发开发与测试,这个选项就能派的上用场。 | |
4 ActionRecord:Base.table_name_suffix="suffix" | |
在表名后面加上指定的字符串 | |
5 ActionRecord:Base.pluralize_table_names=true|false | |
如果为false,表名将与模型名一 致,而不是后者的复数的形式 | |
6 ActionRecord:Base.colorize_logging=tru|false | |
缺省的 情况下,ActionRecord使用ANSI控制序列来记录日志信息,如果用于浏览日志的终端应用支持者这些控制序列,日志信息中的一些 | |
行会 被标记以不同的颜色,如果将此选项设置为false,则不会对日志信息做颜色处理 | |
7 ActionRecord:Base.dafault_timezone=:local|:utc | |
如果设为:utc,将会以UTC格式从数据库 读写日期 | |
8 ActionRecord:Locking.lock_optimistically=true|false | |
如果为 fale,则会禁用对created_at,created_on,updated_at和updated_on等字段的自动更新。 | |
9 ActionRecord:Errors.default_error_messages=hash | |
这个hash存放了标准的校验失败的信息。 可以替换这些信息,这可能是出于国际化的考虑。 | |
ActionPack 配置 | |
1 ActionController::Base.asset_host=url | |
设置存放静态内容(包括样式表,图片等)的主机和/或路由,以便 静态内容辅助标签连接到这些文件。 | |
ActionController::Base.asset_host="http://media.my.url" | |
2 ActionController::Base.view_controller_internals=tru|false | |
缺省 情况下,视图模板可以访问来自控制器的request,response,session和template等对象。如果此选项设置为false,则视图 模板将不能再访问这些信息。 | |
3 ActionController::Base.consider_all_request_local=tru|false | |
通常在生产环境下 将此选项设为false,使用户无法看到错误堆栈。 | |
4 ActionController::Base.debug_routes =true|false | |
如果为true,当路由组建无法解析请求地址时就会给出详细的出错的信息。 | |
5 ActionController::Base.logger=logger | |
设置控制器使用的logger,应用代码也可以使用这个 logger | |
6 ActionController::Base.template_root=dir | |
Rails会到这个目录下来寻 找模板文件,缺省值为app/view | |
7 ActionController::Base.template_class=class | |
缺 省值为ActionView::Base,通常不应该修改此设置。 | |
8 ActionController::Base.ignore_missing_templates=true|false | |
如果为true.在 找不到模板文件时不会抛出错误。 | |
9 ActionController::Base.perform_caching=true|false | |
如 果为false,禁用所有缓存。 | |
10 ActionController::Base.page_cache_directory=dir | |
存 放缓存文件的位置,必须是web服务器的文档根目录 | |
11 ActionController::Base.page_cache_extension=string | |
缓存文件的扩展名,缺省是html. | |
12 ActionController::Base.fragment_cache_store=caching_class | |
指定 如何缓存片段。 | |
13 ActionView::Base.cache_template_loading=false|true | |
如果 为true,会对被渲染的模板文件进行缓存,这可以提高性能,但如果修改了模板文件就必须重起服务器才能看到效果。 | |
14 ActionController::Base.field_error_proc=proc | |
当表单字段校验失败时,会在其前后包裹调用这里设 置的一段程序。确省直如下: | |
Proc.new do |html_tag,instance| | |
%{<div class="fieldWithErrors">#{html_tag}</div>} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment