Changeset 2152
- Timestamp:
- 09/08/05 12:08:24 (3 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/helpers.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r2151 r2152 1 1 *SVN* 2 3 * Avoid extending view instance with helper modules each request. Closes #1979 2 4 3 5 * Performance improvements to CGI methods. Closes #1980 [Skaes] trunk/actionpack/lib/action_controller/base.rb
r2095 r2152 785 785 786 786 private 787 def self.view_class 788 unless @view_class 789 # create a new class based on the default template class and include helper methods 790 logger.debug "defining view class for #{name}" if logger 791 @view_class = Class.new(ActionView::Base) 792 @view_class.send(:include, master_helper_module) 793 end 794 @view_class 795 end 796 797 def self.view_root 798 @view_root ||= template_root 799 end 800 787 801 def initialize_template_class(response) 788 begin 789 response.template = template_class.new(template_root, {}, self) 790 rescue 791 raise "You must assign a template class through ActionController.template_class= before processing a request" 792 end 802 raise "You must assign a template class through ActionController.template_class= before processing a request" unless @@template_class 793 803 804 response.template = self.class.view_class.new(self.class.view_root, {}, self) 794 805 @performed_render = @performed_redirect = false 795 806 end trunk/actionpack/lib/action_controller/helpers.rb
r1425 r2152 17 17 alias_method :inherited, :inherited_with_helper 18 18 end 19 20 # Wrap initialize_template_class to extend new template class21 # instances with the master helper module.22 alias_method :initialize_template_class_without_helper, :initialize_template_class23 alias_method :initialize_template_class, :initialize_template_class_with_helper24 19 end 25 20 end … … 125 120 end 126 121 end 127 128 private129 # Extend the template class instance with our controller's helper module.130 def initialize_template_class_with_helper(response)131 returning(initialize_template_class_without_helper(response)) do132 response.template.extend self.class.master_helper_module133 end134 end135 122 end 136 123 end