def load_view_paths
if configuration.frameworks.include?(:action_view)
ActionController::Base.view_paths.load! if configuration.frameworks.include?(:action_controller)
ActionMailer::Base.view_paths.load! if configuration.frameworks.include?(:action_mailer)
end
end
load! メソッドをさがしてコードを辿っていくと、ActionView::Template::EagerPath#load! と ActionView::ReloadableTemplate::ReloadablePath#load! にたどり着く。
# actionpack-2.3.3/lib/action_view/template.rb
class EagerPath < Path
def load!
return if @loaded
@paths = {}
templates_in_path do |template|
template.load!
template.accessible_paths.each do |path|
@paths[path] = template
end
end
@paths.freeze
@loaded = true
end
~~ 略 ~~
# actionpack-2.3.3/lib/action_view/reloadable_template.rb
class ReloadablePath < Template::Path
~~ 略 ~~
def new_request!
@disk_cache = {}
end
alias_method :load!, :new_request!
~~ 略 ~~
なにをやっているんだろう・・・。
[Rails][CodeReading] Railsの初期化コードを読む (イントロ&目次)
0 件のコメント:
コメントを投稿