def initialize_framework_views
if configuration.frameworks.include?(:action_view)
view_path = ActionView::PathSet.type_cast(configuration.view_path)
ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) && ActionMailer::Base.view_paths.blank?
ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.blank?
end
end
ActionMailer::Base.template_root と、ActionController::Base.view_paths に Configuration.view_path をセットしています(それぞれ、Configuration.frameworksに含まれていれば)。
Configuration.view_path のデフォルトは、おなじみの $RAILS_ROOT/app/views 。
def default_view_path
File.join(root_path, 'app', 'views')
end
[Rails][CodeReading] Railsの初期化コードを読む (イントロ&目次)
0 件のコメント:
コメントを投稿