RoR
文章平均质量分 83
jlaky
这个作者很懒,什么都没留下…
展开
-
Rails源代码分析(2):分发器 Dispatcher
写了两遍~ 受不了这个网站 # Backward-compatible class method takes CGI-specific args. Deprecated # in favor of Dispatcher.new(output, request, response).dispatch. def dispatch(cgi = nil, session_op原创 2008-11-06 14:08:00 · 744 阅读 · 0 评论 -
Rails源代码分析(7):ActionController::Filter(1)
Filter类似于钩子方法,在调用某个controller方法之前、之后或者包围调用这个方法,很有用的方法,利用这个可以很大幅度的减少代码量。1 先研究下种类:1.1 before_filter 多用于验证之类的 # before_filter :verify_credentials # # private # def verify_creden原创 2008-11-12 12:49:00 · 1570 阅读 · 0 评论 -
Rails源代码分析(41):ActionView 概览
require action_view/template_handlerrequire action_view/template_handlers/compilablerequire action_view/template_handlers/builderrequire action_view/template_handlers/erbrequire action_view/t原创 2009-01-05 12:35:00 · 1957 阅读 · 0 评论 -
Rails源代码分析(8):ActionController::Filter(2)
1 概述 昨天主要看了如何使用Filter,今天看看Filter的实现。 这个Module实现中包含这几块: 1 FilterChain 提供了管理Filter对象的方法 2 Filter 所有Filter基类3 AroundFilter 继承自 Filter4 BeforeFilter 继承自 Filter5 AfterFilt原创 2008-11-13 13:48:00 · 804 阅读 · 0 评论 -
Rails源代码分析(9):ActionController::Filter(3)
主要看看如何添加到ActionController的1 ClassMethods module ClassMethods ######################################## # The passed filters will be appended to the filter_chain and # will ex原创 2008-11-14 13:12:00 · 614 阅读 · 0 评论 -
Rails源代码分析(11):ActionController::Layout(2)
module ClassMethods # If a layout is specified, all rendered actions will have their result rendered # when the layout yields. This layout can itself depend on instance variables assigne原创 2008-11-16 21:16:00 · 518 阅读 · 0 评论 -
Rails源代码分析(14):ActionController::MimeResponds
什么是MimeRespondsMimeResponds主要是为了支持Web Service请求:比如 /people/list.html 返回一个html格式的响应比如 /people/list.xml 返回xml格式的响应Rails determines the desired response format from the HTTP Accept header submitted by th原创 2008-11-24 13:19:00 · 747 阅读 · 0 评论 -
Rails源代码分析(15):ActionController::Helpers
1 如何使用默认情况下MyController自动包含MyHelper,add_template_helper 方法可以用来添加自定义的helper Module如果想另外添加,可以用 helper 方法来指定: # ==== Examples # The +to_s+ method from the Time class can be wrapped in a helper meth原创 2008-11-26 12:41:00 · 1258 阅读 · 0 评论 -
Rails源代码分析(20):ActionController::Caching(4) FragmentCache
1 应用Fragment是用来cache一个block的时候使用的,常用于一个页面的页面一部分变化,一部分不变化的情况, Hello @name %> do %> All the topics in the system: :partial => "topic", :collection => Topic.find(:all) %>原创 2008-12-03 12:46:00 · 528 阅读 · 0 评论