Changeset 8645
- Timestamp:
- 01/16/08 01:41:31 (4 months ago)
- Files:
-
- trunk/actionpack/lib/action_controller/base.rb (modified) (4 diffs)
- trunk/actionpack/test/controller/view_paths_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/base.rb
r8633 r8645 643 643 # View load paths for controller. 644 644 def view_paths 645 (@template || self.class).view_paths645 @template.view_paths 646 646 end 647 647 648 648 def view_paths=(value) 649 (@template || self.class).view_paths = value649 @template.view_paths = value 650 650 end 651 651 … … 657 657 # 658 658 def prepend_view_path(path) 659 (@template || self.class).prepend_view_path(path)659 @template.prepend_view_path(path) 660 660 end 661 661 … … 667 667 # 668 668 def append_view_path(path) 669 (@template || self.class).append_view_path(path)669 @template.append_view_path(path) 670 670 end 671 671 … … 1120 1120 end 1121 1121 1122 response.template = ActionView::Base.new( view_paths, {}, self)1122 response.template = ActionView::Base.new(self.class.view_paths, {}, self) 1123 1123 response.template.extend self.class.master_helper_module 1124 1124 response.redirected_to = nil trunk/actionpack/test/controller/view_paths_test.rb
r8564 r8645 29 29 TestController.view_paths = nil 30 30 ActionView::Base.cache_template_extensions = false 31 @controller = TestController.new 31 32 32 @request = ActionController::TestRequest.new 33 33 @response = ActionController::TestResponse.new 34 34 35 @controller = TestController.new 36 # Following is needed in order to setup @controller.template object properly 37 @controller.send :initialize_template_class, @response 38 @controller.send :assign_shortcuts, @request, @response 39 35 40 # Track the last warning. 36 41 @old_behavior = ActiveSupport::Deprecation.behavior … … 49 54 50 55 def test_controller_appends_view_path_correctly 51 TestController.append_view_path 'foo'56 @controller.append_view_path 'foo' 52 57 assert_equal [LOAD_PATH_ROOT, 'foo'], @controller.view_paths 53 58 54 TestController.append_view_path(%w(bar baz))59 @controller.append_view_path(%w(bar baz)) 55 60 assert_equal [LOAD_PATH_ROOT, 'foo', 'bar', 'baz'], @controller.view_paths 56 61 end 57 62 58 63 def test_controller_prepends_view_path_correctly 59 TestController.prepend_view_path 'baz'64 @controller.prepend_view_path 'baz' 60 65 assert_equal ['baz', LOAD_PATH_ROOT], @controller.view_paths 61 66 62 TestController.prepend_view_path(%w(foo bar))67 @controller.prepend_view_path(%w(foo bar)) 63 68 assert_equal ['foo', 'bar', 'baz', LOAD_PATH_ROOT], @controller.view_paths 64 69 end